# Unable to connect with TLS encryption

**URL:** <https://forum.mautic.org/t/unable-to-connect-with-tls-encryption/3799>\
**Category:** Product Support\
**Created:** [May 17, 2016, 5:34pm UTC](https://forum.mautic.org/t/unable-to-connect-with-tls-encryption/3799 "2016-05-17T17:34:07Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![squeegy](https://avatars.discourse-cdn.com/v4/letter/s/dec6dc/32.png) [@squeegy](https://forum.mautic.org/u/squeegy)\
**Post date:** [May 17, 2016, 5:34pm UTC](https://forum.mautic.org/t/unable-to-connect-with-tls-encryption/3799/1 "2016-05-17T17:34:07Z")

</div>

I’m having an issue getting E-mails working, because I don’t feel like retyping everything though, checkout my Stack question for greater detail  
  
  
  
[http://stackoverflow.com/questions/37280019/mautic-unable-to-connect-with-tls-smtp](http://stackoverflow.com/questions/37280019/mautic-unable-to-connect-with-tls-smtp)  
  
  
  
tl;dr;  
  
  
  
I’m using SMTP with TLS to send emails through Mailgun. I have doubly, triply verified that my credentials are correct. And if I set encryption to “none” it works. But with “TLS” I get an error.  
  
  
  
But, if I copy the code from /app/bundles/EmailBundle/Controller/AjaxController.php::testEmailServerConnectionAction() into a test file, I’m able to connect and send emails using TLS. So I’m not sure why I’m getting the error.  
  
  
  
Any help is appreciated, reply here or on the stack question. Thanks

---

<div class="post-metadata">

**Author:** ![squeegy](https://avatars.discourse-cdn.com/v4/letter/s/dec6dc/32.png) [@squeegy](https://forum.mautic.org/u/squeegy)\
**Post date:** [May 17, 2016, 5:34pm UTC](https://forum.mautic.org/t/unable-to-connect-with-tls-encryption/3799/2 "2016-05-17T17:34:07Z")

</div>

I’m having an issue getting E-mails working, because I don’t feel like retyping everything though, checkout my Stack question for greater detail

[http://stackoverflow.com/questions/37280019/mautic-unable-to-connect-with-tls-smtp](http://stackoverflow.com/questions/37280019/mautic-unable-to-connect-with-tls-smtp)

tl;dr;

I’m using SMTP with TLS to send emails through Mailgun. I have doubly, triply verified that my credentials are correct. And if I set encryption to “none” it works. But with “TLS” I get an error.

But, if I copy the code from /app/bundles/EmailBundle/Controller/AjaxController.php::testEmailServerConnectionAction() into a test file, I’m able to connect and send emails using TLS. So I’m not sure why I’m getting the error.

Any help is appreciated, reply here or on the stack question. Thanks

---

<div class="post-metadata">

**Author:** ![squeegy](https://avatars.discourse-cdn.com/v4/letter/s/dec6dc/32.png) [@squeegy](https://forum.mautic.org/u/squeegy)\
**Post date:** [May 17, 2016, 7:46pm UTC](https://forum.mautic.org/t/unable-to-connect-with-tls-encryption/3799/3 "2016-05-17T19:46:39Z")

</div>

Yeah, we ended up finding this is an issue with TLS, SwiftMailer, and PHP 5.6. Downgrading to PHP 5.5 resolved the issue.

Just out of curiosity, what version of PHP were you running when you tested that?

I have updated the Stackoverflow quesiton with my findings if you’re interested in more details.

---

<div class="post-metadata">

**Author:** ![amagdy](https://avatars.discourse-cdn.com/v4/letter/a/3e96dc/32.png) [@amagdy](https://forum.mautic.org/u/amagdy)\
**Post date:** [September 30, 2016, 12:32pm UTC](https://forum.mautic.org/t/unable-to-connect-with-tls-encryption/3799/4 "2016-09-30T12:32:40Z")

</div>

I was experiencing the same issue and this was resolved by disabling SMTP Restrictions in my server environment as per the attached image. ![](https://cloud.githubusercontent.com/assets/22257012/18983251/f311e2c2-86eb-11e6-808b-f8c1a6d44080.JPG)

I was able to use “Amazon SES” as my option in “Service to send Email through”.

---

<div class="post-metadata">

**Author:** ![gregdickson](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/gregdickson/32/2029_2.png) [@gregdickson](https://forum.mautic.org/u/gregdickson)\
**Post date:** [January 7, 2021, 2:03pm UTC](https://forum.mautic.org/t/unable-to-connect-with-tls-encryption/3799/5 "2021-01-07T14:03:15Z")

</div>

Amagdy - Thanks worked a treat.

If your host uses Cpanel it’s under “Allow Outbound SMTP”

---

<div class="post-metadata">

**Author:** ![Shaz3e](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/shaz3e/32/236_2.png) [@Shaz3e](https://forum.mautic.org/u/Shaz3e)\
**Post date:** [January 30, 2023, 11:09am UTC](https://forum.mautic.org/t/unable-to-connect-with-tls-encryption/3799/6 "2023-01-30T11:09:35Z")

</div>

This has resolved my problem. +1
