I’m trying to use the EmailMessage and SMTPSecureSocket Classes to send email via the Gmail outgoing Server. I am using the following method after the fields are completed on the form:
[code]
Dim oMail As EmailMessage
Dim i As Integer
Dim s As String
MailSocket.Address = trim(tfServer.Text) // smtp.gmail.com
MailSocket.Port = 25
MailSocket.Username = trim(tfUserName.Text)
MailSocket.Password = trim(tfPassword.Text)
MailSocket.Secure = True
MailSocket.ConnectionType = SSLSocket.TLSv1
oMail = New EmailMessage
oMail.FromAddress = “ashXXXXXXX1138@gmail.com”
oMail.Subject = tfSubject.Text
oMail.BodyPlainText = taMessage.Text
oMail.Headers.AppendHeader(“X-Mailer”,“LSA SMTP Demo”)
oMail.AddRecipient(trim(tfTo.Text))
MailSocket.Messages.Append(oMail)
MailSocket.SendMail
i = MailSocket.LastErrorCode
s = "Message Result = " + str(i)
MsgBox(s)
Return [/code]
have attempted with and without the MailSocket.Secure = True and MailSocket.ConnectionType = SSLSocket.TLSv1 statements.
Tracing the code and checking the values in the debugger, everything appears correct and the resulting msgbox says the return code is 0 or no error.
Yet the message never arrives.
Can someone please tell me how to make this work.
thanks,