Hello,
i’m new to Xojo and i am reading the “Introduction to Programming with Xojo” from this Xojo Site.
At chapter 11.5 of the book there is a code example for sending mails with SMTPSecureSocket. I have first tried sending a mail using the code
for “Google Mail” as in the book, then i changed the code to the following (after reading some posts in the forum):
MailSocket.Address = "smtp.gmail.com"
MailSocket.Username = "myusername@googlemail.com"
MailSocket.Password = "mypassword"
MailSocket.Port = 587
MailSocket.ConnectionType = SMTPSecureSocket.TLSv1
MailSocket.Secure = true
Dim Start as New Date
While 1=1
MailSocket.Connect
Dim Now as New Date
if Now.TotalSeconds - Start.TotalSeconds > 60 Then Exit
if MailSocket.IsConnected Then Exit
Wend
SendTheMessage
The method “SendTheMessage” is:
Dim m As EmailMessage
m = New EmailMessage
m.AddRecipient(ToField.Text)
m.Subject = SubjectField.Text
m.BodyPlainText =MessageField.Text
m.FromAddress = "myusername@googlemail.com"
MailSocket.Messages.Append(m)
MailSocket.SendMail
But i always get a lot of SMTP ERROR: Password command failed:
[quote]534-5.7.14 …
534-5.7.14 … Please log in via your web browser and
534-5.7.14 then try again.
534-5.7.14 Learn more at
534 5.7.14 https://support.google.com/mail/bin/answer.py?answer=78754[/quote]
At this google site you can read the following:
[quote]If you’re still having problems, visit http://www.google.com/accounts/DisplayUnlockCaptcha and
sign in with your Gmail username and password. If necessary, enter the letters in the distorted picture.
Your mail app might not support the latest security standards. Learn how to allow less secure apps access to your account.[/quote]
The first solution didn’t work at all and the second one gives me this link to a site where i can “activate access for less secure apps”. But i don’t want to lower the security for my gmail account.
I looked at the security information of my gmail account in chrome browser:
mail.google.com uses TLS 1.2 with a 128bit encryption
the connection is encrypted and authenticated with AES_128_GCM
RSA is used for key-exchange
So, can anyone please tell me how to write the code to be able to send messages with SMTPSecureSocket and my googlemail account -
or doesn’t XOJO support the latest security standards in their SMTPSecureSocket.TLS implementation yet ?
Greetings from Germany
Ralf