Hello,
I got a very simple question;
How to send an e-mail with a O365 account using ASP.Net? The current error I'm getting is;
System.Net.Mail.SmtpException: Mailbox unavailable. The server response was: 5.7.1 Client does not have permissions to send as this sender
I've read many, many, pages. Some stating the use of SMTP Virtual Server, that it's not supported at all, that it's the From entry and some several more attempts.
Anyway, none of them did me good and I've yet send an e-mail. I've once made it to work using another SMTP Relay. (Not very SPF friendly...)
Under here you'll find the current mailSettings entry for web.config, what I've tried so far:
- From=
- "Info | MyDomain" which is my display name as stated by O365 itself.
- "Info | MyDomain <info@mydomain.com>"
- "info@mydomain.com"
- "<info@mydomain.com>"
- Different ways using SMTP Virtual Server
- Set Send-As permission on administrator level on the info@mydomain.com account. (info@mydomain.com given send-as permission for info@mydomain.com)
<system.net><mailSettings><smtp from="Info | MyDomain" deliveryMethod="Network"><network enableSsl="true" host="smtp.office365.com" port="587" userName="info@MyDomain.com" password="MyDomainMyDomainMyDomain" defaultCredentials="false" /></smtp></mailSettings></system.net>
Regards, MusicDemon