My client switched to Office365, so I have to set up the SMTP in MODX to make the forms work.
But mail is not sent. The form keeps spinning for a while, then reloads, then nothing (the filled in fields are still filled in). No autoResponse, no mails, no redirect page, no nothing.
This is what I have set:
SMTP Authentication = Yes
SMTP Hosts = smtp.office365.com
SMTP Password = your email password
SMTP Port = 587
SMTP Connection Prefix = tls
SMTP User = your full email address
Use SMTP = Yes
My snippet is:
Een bericht van [[+contact_name]]
Strange thing is: if I set mail_smtp_auth and mail_use_smtp to ‘no’, it works fine. How is that supposed to work?
to diagnose, if sending mails works at all, you can try
Bob’s Guides | QuickEmail Snippet (bobsguides.com)
If you’re setting “mail_use_smtp” to no, it’s using the web hosts internal mail system instead, side-stepping the whole SMTP set up so all SMTP-related problems would vanish but you’re also losing the benefits of SMTP sending.
+1 to using the QuickEmail snippet. Add the ‘debug’ to that and you’ll have the best chance to discover a world of helpful information to trouble shoot the specific set up with the SMTP option.
Office / Microsoft 365, like a number of other email systems, require that you configure the SMTP relay on the servers. Without this, the SMTP relay is rejected and you cannot send your email from your application.
In Office 365 (which uses a Microsoft Exchange server), this is setup is called “connectors”. To configure this, go to the Office 365 Admin center, then select the Microsoft Exchange admin center and select the “Mail Flow” => “Connectors” option. On this page, there is a link to some help documents from Microsoft regarding the setup of an appropriate connector.
Here is a link to the general help document from Microsoft: Do I need to create a connector in Exchange Online? | Microsoft Docs
in your case, I suggest you follow the procedure under the third point “All of your mailboxes are in Exchange Online, but you need to send email from sources in your on-premises organization” => How to set up a multifunction device or application to send email using Microsoft 365 or Office 365 | Microsoft Docs
Hope this helps
I am not sure why I should check settings in Office 365. My client uses Office 365 through a dedicated company. I cannot access any of these settings. It has nothing to do with their website which is done by me.
Why are the other settings kept in MODX when you switch “mail_use_smtp” to no? It’s quite confusing.
Fact is, it’s still not working. Forms are not sent to the right mailbox, but are lost.
Because you’re sending emails through their SMTP server (or relay). To allow emails to go through, both parties need to be aligned.
Have you tried debugging with QuickEmail yet? That’s very good at pinpointing authentication or other errors. It can also tell you that sending worked correctly, meaning the problem is on the receiving end instead.
Install the extra and place the following on a resource:
Another great tool for debugging email deliverability issues (i.e. quickemail reports a successful send, but it doesn’t arrive) is mail-tester.com. That will test your SPF, DKIM and DMARC settings, analyse its spam score, check blacklists and a bunch more.
Easy to test again with QuickEmail.
[[!QuickEmail? &debug=`1` &to=`<email provided by mail-tester.com>`]]
The test with the QuickEmail renders this:
2021-06-30 13:44:24 SMTP ERROR: Failed to connect to server: Connection timed out (110)
That suggests it can’t reach the SMTP server that’s configured. In my experience a timeout suggests the wrong port or connection prefix.
It’s best to ask the email admins what settings to use, or you can try different combinations and maybe get lucky by stumbling across the right configuration:
- port 465 instead of 587
- ssl instead of tls for the connection prefix
When the quickemail output changes, you know you’re heading in the right direction.
Or like @jcreiss suggests outside SMTP access may first need to be enabled by the email admin with a relay or connector. It’s definitely best to talk to them to find out the required configuration to put in MODX.
I already had contact with the email provider and they said it’s all fine on their side…
Did you ask them what connection settings to use to send via SMTP?
Yes, the one I’m using. So I’m a bit clueless right now.
This is not the first time I am encountering problems with Office 365; most of these email providers ‘forget’ that there is hosting with existing email accounts still live, or contact forms on websites, etc.
did you try, what happens when you test with one of this sevices?
smtp mail test at DuckDuckGo
I think it may be necessary to set up an App password in the Microsoft o365 settings, specifically for use by the website form.
There is a discussion about the issue in relation to phpMailer here: