SMTP - Email Sent with Invalid From Address

Hi,

I use exchange server to send an email using 'SMTPClient' and provide a bad 'From' Address, I expect the 'send' to fail but the email gets sent with the 'From' Address though it is invalid. I get an error as expected with other mail servers like gmail, office365 etc.. Is there a way to validate the Email Address before sending emails.

Regards

Sathyapriya

Hi Sathyapriya,

Thank you for writing to Aspose support team.

I have tested this issue by trying to send email using the API’s SmtpClient with Exchange Server and get SmtpException, “Mailbox Unavailable, client doesn’t have permission to send using this sender”. Thus, we are unable to reproduce this issue at our end as you have mentioned. Following is the sample code that has been used at my end:

Code:

SmtpClient client = new SmtpClient("http://exchange.domain.com/", "username", "password");
client.Send(new MailMessage("badUserName@domain.com", "to@gmail.com", "Bad from address", "Message body"));