SMTPSecureSocket

Hi Have this code for send email but it takes some time long time to receive the email to the person.

If any one have same problem or i am doing something wrong .
I use gmail

Dim Mail As New EmailMessage
Dim SendTo,s As String
Dim i As Integer
Dim kk As String

SendTo=CompanyEmail

If System.Network.LookupIPAddress(“google.com”) <> “” Then

eMailControl01.Address ="smtp.gmail.com"
eMailControl01.Port = 587
eMailControl01.Username =MaineMail.Trim
eMailControl01.Password = MaineMailpass.Trim

// Connect To Server
eMailControl01.Secure = True
eMailControl01.ConnectionType = SSLSocket.TLSv1
eMailControl01.Connect()

// Populate Email Message
Mail.FromAddress =CompName
Mail.Subject =eNombre
Mail.BodyPlainText =eMensage
Mail.Headers.AppendHeader eLocate01,"GasPos v1.0"


'SendTo = txtSendNumber.Text + "@" + pmCarrier.RowTag(pmCarrier.ListIndex)
s = replaceAll(SendTo,",",chr(13))
s = replaceAll(s,chr(13)+chr(10),chr(13))
for i = 1 to countFields(s,chr(13))
  Mail.addRecipient trim(nthField(s,chr(13),i))
next

// Send Email
eMailControl01.Messages.Append Mail
eMailControl01.SendMail()
'eMailControl.Poll

Else
eMailSalio=True

End If

Your code looks alright to me.

This bit

s = replaceAll(SendTo,",",chr(13)) s = replaceAll(s,chr(13)+chr(10),chr(13)) for i = 1 to countFields(s,chr(13)) Mail.addRecipient trim(nthField(s,chr(13),i)) next

could be simplified to

for i = 1 to countFields(s,",") Mail.addRecipient trim(nthField(s,",",i)) next

But I doubt that would have a great speed impact.

Gmail can be slow sometimes to forward messages.

Ok
Thanks