I used this code in desktop application that works fine.
[code] Dim mail as New EmailMessage
Dim SMTPSecureSocket1 as New SMTPSecureSocket
SMTPSecureSocket1.address = “smtp.gmail.com”
SMTPSecureSocket1.port = 587
SMTPSecureSocket1.Secure = True
SMTPSecureSocket1.ConnectionType = 3
SMTPSecureSocket1.Username = “sender@gmail.com”
SMTPSecureSocket1.Password = “mypassword”
SMTPSecureSocket1.Connect
Dim Start as New Date
While 1=1
SMTPSecureSocket1.Connect
Dim Now as New Date
if Now.TotalSeconds - Start.TotalSeconds > 60 Then Exit
if SMTPSecureSocket1.IsConnected Then Exit
Wend
mail.fromAddress= “sender@domain.com”
mail.subject= “test”
mail.AddRecipient “recipient@domain.com”
mail.bodyPlainText = “Test email”
SMTPSecureSocket1.DeleteAllMessages
SMTPSecureSocket1.Messages.Append mail
SMTPSecureSocket1.SendMail[/code]
The same code in Run.Event of a console application doesn’t send the email.
What’s wrong?
Pietro