- Yuko Tanaka
- PowerBuilder
- Friday, 19 May 2023 06:16 PM UTC
Hi,
I have the following codes that I based from the sample given in Appeon side. I'm using PowerBuilder 2022 R2 Beta. My IT department said that we can send email through our SMTP server without authentication, and leave Password, SecureProtocol, EnableTLS blank. When I try to send using send(), I get return code of -4 or -15.
1. Are Password, secureProtocol, EnableTLS required even when our SMTP server doesn't require authentication? If so, what values should I use for SMTP that doesn't require authentication?
2. Is there a list of error code and how to solve it where I can refer to to resolve issues that I encounter?
Thank you.
Yuko
====
integer li_rc
// Create SmtpCLient
SmtpClient lsc_mail
lsc_mail = create SmtpClient
// Set Email Server Info
lsc_mail.Host = 'oursmtpserver.com'
lsc_mail.Port = 99
lsc_mail.Username = 'powerbuilder2022beta@oursmtpserver.com'
//lsc_mail.Password = ''
//lsc_mail.secureProtocol = 0 // All secure protocols
//lsc_mail.EnableTLS = True
// Set Sender, Recipient
lsc_mail.message.SetSender('powerbuilder2022beta@oursmtpserver.com', 'sender')
lsc_mail.message.AddRecipient('me@oursmtpserver.com', 'testername')
// Set Subject, HTMLBody and Resource Link
lsc_mail.message.Subject = 'PowerBuilder 2022 Beta email test'
lsc_mail.message.HTMLbody = '<html><body><p><b>Test Mail.</b></p><br /></body></html>'
// Send it
li_rc = lsc_mail.Send()
//li_rc = lsc_mail.SendAsync() // Send email asynchronously using this function
messagebox('li_rc', li_rc)
// Reset and Destroy
lsc_mail.Message.Reset()
Destroy lsc_mail
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.