I'm trying to set up the Direct Send SMTP method for Office365 but I'm getting an error message:
Swift_TransportException: Connection could not be established with host {our-tenant-id}.mail.protection.outlook.com [No connection could be made because the target machine actively refused it.
The Microsoft documentation says that these are the required settings:
| Server/smart host | Your MX endpoint, for example, contoso-com.mail.protection.outlook.com
| Port | Port 25
| TLS/StartTLS | Enabled
| Email address | Any email address for one of your Office 365 accepted domains.
| | This email address does not need to have a mailbox.
So these are the settings I have used in the .env
file:
MAIL_DRIVER=smtp
MAIL_HOST={our-tenant-id}.mail.protection.outlook.com
MAIL_PORT=25
MAIL_USERNAME=mailbox@ourdomain.co.uk
MAIL_PASSWORD=password
MAIL_ENCRYPTION=tls
I have also checked our SPF record which I can confirm contains the correct entries, according to the documentation.
Has anyone else set this up before or knows where I might be going wrong?
We use a similar setup. Beware that building the connection to office can be a bit slow, so you want to queue the emails to make sure the user doesn't ahve to wait.
MAIL_DRIVER=smtp
MAIL_HOST=smtp.office365.com
MAIL_PORT=587
MAIL_USERNAME=mailbox@ourdomain.co.uk
MAIL_PASSWORD=password
MAIL_ENCRYPTION=tls
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.