0 votes

According to you code examples and the SMTP standard, I should be able to sent an email from an account (eg admin@example.com) and use a different account to authorise the server (eg casedatabase@example.com).

If I do this, the email appears to send ok (no exceptions thrown) but then it never gets delivered to the “Sendto” account and we can’t find the emails on message trace.

If I send from the SAME account as the server credentials and set ReplyTo: to admin@example.com it all works correctly and the email gets send and delivered.

I can’t work out why this is happening, and our Office365 support don’t have a clue.

I just wondered if you had seen this before and knew what the solution was. I’ve been using your Mail.dll for about 4 years now but I have been using the second example in my code (same account for From and the server); but someone told me the first example should work; it doesn’t work, but it should.

Any help would really be appreciated.

by

1 Answer

0 votes

There are 5 'from' addresses when you send an email:

1.
SMTP credentials/SMTP authentication - this is what you provide to Smtp.Login / Smtp.UseBestLogin methods.
It is used to authenticate against SMTP server.

2.
SMTP envelope - this is what you provide in 'MAIL FROM' command during SMTP conversation.

By default Mail.dll takes it from IMail.From / IMail.Sender fields, when needed (VERP) it can be explicitly specified by using SmtpMail class.

This address is used for non-delivery reports.

3.
'From: ' email header - who wrote the message (it can be a list) - IMail.From

4.
'Sender: ' email header - who sent the message - IMail.Sender.

5.
'Reply-To: ' email header - who should get a reply, when recipient hits reply in their email client - IMail.ReplyTo.

In most cases all those address are equal.

Most servers don't allow sending email in someone else name.

If I do this, the email appears to send ok (no exceptions thrown)

Please examine the return value of Smtp.SendMessage method. Especially Status field.

You can turn on logging to obtain SMTP communication logs:
https://www.limilabs.com/blog/logging-in-mail-dll

by (301k points)
...