Hi all,
Using PB2022 R2. Thought I'd play around with the new SMTP features.
I've got a window with a button on it. The button just sends a test message via SMTP. Everything is hard coded. SMTPClient.Send keeps returning an error. Here's the code:
Integer li_rc
SMTPClient lnv_SmtpClient
lnv_SmtpClient = CREATE SMTPClient
//Sets the email-sender information
lnv_SmtpClient.Host = "smtp.gmail.com"
lnv_SmtpClient.Port = 465
lnv_SmtpClient.Username = "myemail@gmail.com"
lnv_SmtpClient.password = "mypassword"
lnv_SmtpClient.EnableTLS = False
//Sets the email message
lnv_SmtpClient.Message.SetSender("myemail@gmail.com" , "My Name")
lnv_SmtpClient.Message.AddRecipient("abc.123@MyCompany.com")
lnv_SmtpClient.Message.Subject = "SMTPClient Test Message"
lnv_SmtpClient.Message.TextBody = "SMTPClient example message body"
//Sends the email
li_rc = lnv_SmtpClient.Send()
IF li_rc = 1 THEN
Messagebox('SMTPClient','Mail sent successfully')
ELSE
Messagebox('SMTPClient' ,'Email sending failed. Return ' + String(li_rc) + '.', StopSign!)
END IF
DESTROY lnv_SmtpClient
(Username and password changed to protect the innocent.)
When I use port 465, TLS = FALSE, I get error -14 .
When I use port 587, TLS = TRUE, I get error -12.
Any thoughts?
~~~Tracy
The following response in the referenced thread by the original poster seems pretty clear to me:
----------------
I did the setup necessary for google and it still didn't work.
Created an outlook account and that worked fine.
Thanks for all the ideas :-)
----------------