7

I know that CiviCRM can send e-mail using SMTP and SSL by prefixing ssl:// to the SMTP server name, but my organization uses Office365, which only supports SMTP with TLS. Is there a way to get CiviCRM to work with the Office365 SMTP server (ideally without resorting to Postfix and sendmail)?

  • Using SMTP directly to hosted mail products will be tangibly slower while the SMTP transaction blocks the PHP request; having a "real" local MTA which then smarthosts to Office 365 allows CiviCRM to offload messages quicker. You seem to want to avoid "resorting to Postfix" so I haven't posted this as an answer, but it's an option worth considering. – Chris Burgess Apr 10 '15 at 10:00
  • @ChrisBurgess - I hadn't thought of using the local MTA to smarthost. a bit off-topic but seems like a best practice in terms of performance :) nice. – Sonicthoughts Apr 16 '15 at 18:25
  • I'll add that as an answer then :) – Chris Burgess Apr 16 '15 at 19:04
  • I've updated the question to remove the explicit prohibition on Postfix and sendmail, especially in light of the SMTP TLS auth bug. – Russell Ault Jul 20 '15 at 4:38
7

For performance, avoid remote SMTP entirely.

Using SMTP directly to hosted mail products will be tangibly slower while the SMTP transaction blocks the PHP request; having a "real" local MTA which then smarthosts to Office 365 allows CiviCRM to offload messages quicker (local process/filesystem versus remote network).

Stack Exchange prefers documenting the actual process to external links but in this case I'll do the latter since you have several options, and hey, I'm already not answering your actual request :)

  • That wasn't nearly as painful as I was expecting it to be, and it's the first time I've ever seen CiviCRM actually send me an e-mail, so I'm absolutely thrilled right now. Thank you! – Russell Ault Jul 20 '15 at 4:40
  • Glad to hear it Russell! – Chris Burgess Jul 21 '15 at 2:40
3

CiviCRM supports TLS connections - and IIRC you just preface with ssl:// (even though it's TLS, not SSL) and select the appropriate port.

However, TLS is currently broken if authentication is required - see https://issues.civicrm.org/jira/browse/CRM-14814 and http://forum.civicrm.org/index.php?topic=21960.0. There seems to be an open PR (https://github.com/civicrm/civicrm-packages/pull/66) - I'm not sure why this wasn't merged, but it's against Civi 4.4, and would probably need to be ported forward.

1

I have used tls://pod51010.outlook.com:465 to connect to an Office365 SMTP server with other software (Forum). Since CiviCRM allows us to specify the port, I would just use tls://pod51010.outlook.com as the SMTP Server Name.

I cannot test with CiviCRM right now as I no longer have an Office 365 account, but I would give that a try first.

1

As Jon G notes, TLS is currently broken. The Forum reference gives patching information, which I've just now successfully applied to CiviCRM 4.6.8, running under WordPress 4.3.1. The broken module is: (your http root)/wordpress/wp-content/plugins/civicrm/civicrm/packages/Net/SMTP.php

Searching the module for the text "// CiviCRM: CRM-8744" get you to the right spot to follow the instructions given by TravelingPharaoh in the forum post, reply 10 (BTW: Thanks to TravelingPharaoh). A reboot, and you are in business.

So this is another confirmation of the need for the fix that is in progress, per CRM-14814.

Thanks, guys.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.