Question:
Hi,
I'm trying to send an email with SendGrid to my ticket system Uservoice and get the following error:
220 SG ESMTP service ready at ismtpd0001p1lon1.sendgrid.net
EHLO Trixis-Mac-Pro.fritz.box<CRLF>
250-smtp.sendgrid.net
250-8BITMIME
250-PIPELINING
250-SIZE 31457280
250-AUTH PLAIN LOGIN
250 AUTH=PLAIN LOGIN
AUTH LOGIN<CRLF>
334 VXNlcm5hbWU6
bWFpbEBiZWF0cml4d2lsbGl1cy5kZQ==<CRLF>
334 UGFzc3dvcmQ6
{PasswordOrCredentials}
235 Authentication successful
MAIL FROM:<Beatrix Willius bwillius@gmx.de><CRLF>
RCPT TO:<tickets@mothsoftware.uservoice.com><CRLF>
DATA<CRLF>
501 Sender syntax error
503 Must have sender before recipient
503 Must have valid receiver and originator
RSET<CRLF>
250 I remember nothing
The code is
'set up the chilkat version of the socket
Dim mailman As New Chilkat.MailMan
Dim success As Boolean = mailman.UnlockComponent("test")
If (success <> True) Then
Return
End If
'do the smtp details
mailman.SmtpHost = "smtp.sendgrid.net"
mailman.SmtpUsername = "username"
mailman.SmtpPassword = "password"
mailman.SmtpSsl = True
mailman.SmtpPort = 465
// populate the email message to company
Dim MailToCompany As New Chilkat.Email
MailToCompany.fromAddress = "<test>"
MailToCompany.subject = "Error Report"
call MailToCompany.AddTo("", "tickets @ mothsoftwarexxxuservoicexxxcom")
success = mailman.SendEmail(MailToCompany)
If (success <> True) Then
System.DebugLog(mailman.LastErrorText)
Return
End If
success = mailman.CloseSmtpConnection()
If (success <> True) Then
System.DebugLog("Connection to SMTP server not closed cleanly.")
End If
The problem seems to be specific to SendGrid because I found a couple of mentions at https://github.com/bcit-ci/CodeIgniter/issues/2289 or http://stackoverflow.com/questions/39901300/smtp-mail-server-sendgrid-error-on-submission/39902008. But I don't know how this applies to my code.
Xojo 2016r3, MacOS 10.11, Chilkat plugin from June 2016
Mit freundlichen Grüßen/Regards
Beatrix Willius
http://www.mothsoftware.com Mail Archiver X: The email archiving solution for professionals
Hi Beatrix,
The address passed to the "MAIL FROM" command in the SMTP session should only include the email address (not the friendly name)
This is incorrect:
MAIL FROM:<Beatrix Willius bwillius@gmx.de><CRLF>
This is correct:
MAIL FROM:<bwillius@gmx.de><CRLF>
I suspect the issue is that the email object's FromAddress was set to the string "Beatrix Willius bwillius@gmx.de" Make sure the FromAddress is set to "bwillius@gmx.de", and the FromName is set to "Beatrix Willius". An alternative is to set the From property equal to the entire string: "Beatrix Willius bwillius@gmx.de"
See this example: http://www.example-code.com/xojo/email_from.asp
Thanks! Changing the FromAddress solved the problem.
Mit freundlichen Grüßen/Regards
Beatrix Willius
http://www.mothsoftware.com Mail Archiver X: The email archiving solution for professionals