Hi I am trying to send an email using Rebex Smtp SendDirect and I get this error:
SendEmail: Rebex.Net.SmtpException: Client was not authenticated (530).
at Rebex.Net.Smtp.WCB(String A, String B)
at Rebex.Net.Smtp.ADB(String A, String[] B, String C, Stream D, TransferEncoding E)
at Rebex.Net.Smtp.GDB(MimeMessage A, Stream B, MailAddress C, MailAddressCollection D)
at Rebex.Net.Smtp.SendDirect(MimeMessage message)
at Rebex.Net.Smtp.SendDirect(MailMessage message)
My code:
Dim myMail As New Rebex.Mail.MailMessage
Try
myMail.From = "myname@myCompany.com"
myMail.Subject = "Test"
myMail.BodyText = "Blah blah"
myMail.To = "myname@myCompany.com"
myMail.Attachments.Add(New Rebex.Mail.Attachment(filePath))
myMail.Priority = Rebex.Mail.MailPriority.Normal
Smtp.SendDirect(myMail)
Catch ex As Rebex.Mail.MailException
Catch ex As System.Exception
Finally
End Try
Notice that sender's and receiver is the same email address.
The company uses an Exchange server.
When I put as receiver's email address my gmail address the code works fine.
What I am doing wrong?