Answers.Body: <p>For performance, avoid remote SMTP entirely.</p>
  
  <p>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).</p>
  
  <p>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 :)</p>
  
  <ul>
  <li>Configure CiviCRM to use local mail delivery, AND</li>
  <li><a href="http://secopsmonkey.com/mail-relaying-postfix-through-office-365.html">Configure Postfix to smarthost to office365 using SMTP auth for a single origin address</a>, OR</li>
  <li><a href="http://secopsmonkey.com/better-mail-relaying-postfix-through-office-365.html">Configure Postfix to smarthost to office365 using Office365 connectors for multiple origin addresses</a>, OR</li>
  <li>Do the same for your preferred local MTA.</li>
  </ul>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-07-20T04:40:20.117Z
Answers.Text: 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!
Answers.UserDisplayName: Russell Ault
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-07-21T02:40:54.117Z
Answers.Text: Glad to hear it Russell!
Answers.UserDisplayName: Chris Burgess
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-16T19:15:06.107Z
Answers.LastActivityDate: 2015-04-16T19:15:06.107Z
Answers.UserDisplayName: Chris Burgess
Answers.Body: <p>CiviCRM supports TLS connections - and IIRC you just preface with ssl:// (even though it's TLS, not SSL) and select the appropriate port.</p>
  
  <p>However, TLS is currently broken if authentication is required - see <a href="https://issues.civicrm.org/jira/browse/CRM-14814" rel="nofollow">https://issues.civicrm.org/jira/browse/CRM-14814</a> and <a href="http://forum.civicrm.org/index.php?topic=21960.0" rel="nofollow">http://forum.civicrm.org/index.php?topic=21960.0</a>.  There seems to be an open PR (<a href="https://github.com/civicrm/civicrm-packages/pull/66" rel="nofollow">https://github.com/civicrm/civicrm-packages/pull/66</a>) - I'm not sure why this wasn't merged, but it's against Civi 4.4, and would probably need to be ported forward.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-09T16:45:03.607Z
Answers.LastActivityDate: 2015-04-09T16:45:03.607Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.Body: <p>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.</p>
  
  <p>I cannot test with CiviCRM right now as I no longer have an Office 365 account, but I would give that a try first.  </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-09T11:53:29.610Z
Answers.LastActivityDate: 2015-04-09T11:53:29.610Z
Answers.UserDisplayName: Kevin Cristiano
Answers.Body: <p>In 2023, the easiest answer is a hook in an extension, e.g.:</p>
  <pre><code>// Force STARTTLS
  function wisctweaks_civicrm_alterMailer(&amp;$mailer, $driver, $params) {
    $mailer-&gt;__set('starttls', true);
  }
  </code></pre>
  <p>I'm not saying the other answers don't work - but this was easier than testing everything else.</p>
  <p>Note that if you want to use STARTTLS without authentication, you need CiviCRM 5.57+ (earlier versions of the <code>pear/mail</code> and <code>pear/net</code> libraries didn't support it.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-01-06T20:00:00.377Z
Answers.LastActivityDate: 2023-01-06T20:00:00.377Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.Body: <p>As Jon G notes, TLS is currently broken.  The <a href="http://forum.civicrm.org/index.php?topic=21960.0" rel="nofollow">Forum reference</a> 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</p>
  
  <p>Searching the module for the text "// CiviCRM: CRM-8744" get you to the right spot to follow the instructions given by TravelingPharaoh in the <a href="https://forum.civicrm.org/index.php?topic=21960.msg97008#msg97008" rel="nofollow">forum post, reply 10</a> (BTW:  Thanks to TravelingPharaoh).  A reboot, and you are in business.  </p>
  
  <p>So this is another confirmation of the need for the fix that is in progress, per <a href="https://issues.civicrm.org/jira/browse/CRM-14814" rel="nofollow">CRM-14814</a>.</p>
  
  <p>Thanks, guys.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-02T16:28:16.983Z
Answers.LastActivityDate: 2015-10-02T16:33:32.317Z
Answers.LastEditDate: 2015-10-02T16:33:32.317Z
Answers.UserDisplayName: dvhirst
Body: <p>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)?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-04-10T10:00:23.970Z
Comments.Text: 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.
Comments.UserDisplayName: Chris Burgess
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-04-16T18:25:07.777Z
Comments.Text: @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.
Comments.UserDisplayName: Sonicthoughts
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-04-16T19:04:16.217Z
Comments.Text: I'll add that as an answer then :)
Comments.UserDisplayName: Chris Burgess
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-07-20T04:38:37.053Z
Comments.Text: I've updated the question to remove the explicit prohibition on Postfix and sendmail, especially in light of the SMTP TLS auth bug.
Comments.UserDisplayName: Russell Ault
Tags: <email><configuration>
Title: How do I configure SMTP with STARTTLS?
ThreadText: # How do I configure SMTP with STARTTLS?
  
  (Asked by: username_0 on 2015-04-08)
  
  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)?
  
  **Tags:** email, configuration
  
  > **Comments:**
  > **username_1**: 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.  
  > **username_2**: @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.  
  > **username_1**: I'll add that as an answer then :)  
  > **username_0**: I've updated the question to remove the explicit prohibition on Postfix and sendmail, especially in light of the SMTP TLS auth bug.  
  
  ---
  
  ## 5 answers
  
  ### Answer by username_1 on 2015-04-16. Score: 7 | Accepted answer
  
  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 :)
  
  * Configure CiviCRM to use local mail delivery, AND
  * [Configure Postfix to smarthost to office365 using SMTP auth for a single origin address](http://secopsmonkey.com/mail-relaying-postfix-through-office-365.html), OR
  * [Configure Postfix to smarthost to office365 using Office365 connectors for multiple origin addresses](http://secopsmonkey.com/better-mail-relaying-postfix-through-office-365.html), OR
  * Do the same for your preferred local MTA.
  
  > **Comments:**
  > **username_0**: 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!  
  > **username_1**: Glad to hear it Russell!  
  
  ---
  
  ### Answer by username_3 on 2015-04-09. Score: 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.
  
  
  ---
  
  ### Answer by username_4 on 2015-04-09. Score: 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.
  
  
  ---
  
  ### Answer by username_3 on 2023-01-06. Score: 1
  
  In 2023, the easiest answer is a hook in an extension, e.g.:
  // Force STARTTLS
  function wisctweaks_civicrm_alterMailer(&$mailer, $driver, $params) {
    $mailer->__set('starttls', true);
  }
  
  I'm not saying the other answers don't work - but this was easier than testing everything else.
  Note that if you want to use STARTTLS without authentication, you need CiviCRM 5.57+ (earlier versions of the pear/mail and pear/net libraries didn't support it.
  
  
  ---
  
  ### Answer by username_5 on 2015-10-02. Score: 1
  
  As Jon G notes, TLS is currently broken. The [Forum reference](http://forum.civicrm.org/index.php?topic=21960.0) 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](https://forum.civicrm.org/index.php?topic=21960.msg97008#msg97008) (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](https://issues.civicrm.org/jira/browse/CRM-14814).
  
  Thanks, guys.
  
  
  ---
  
  