# New server - Cannot connect to Mailgun

**URL:** <https://forum.mautic.org/t/new-server-cannot-connect-to-mailgun/23739>\
**Category:** Product Support\
**Created:** [April 14, 2022, 7:38am UTC](https://forum.mautic.org/t/new-server-cannot-connect-to-mailgun/23739 "2022-04-14T07:38:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![enricosigurta](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/enricosigurta/32/3676_2.png) [@enricosigurta](https://forum.mautic.org/u/enricosigurta)\
**Post date:** [April 14, 2022, 7:38am UTC](https://forum.mautic.org/t/new-server-cannot-connect-to-mailgun/23739/1 "2022-04-14T07:38:14Z")

</div>

**Your software**  
My Mautic version is: 4.1  
My PHP version is: 7.4  
My Database type and version is: mySQL, latest version

**Your problem**  
My problem is:  
We recently moved Mautic from a shared hosting to a dedicated server. The servers have the exact same technology and they are from the same comany. On the shared hosting I could connect to mailgun without any issue, using the “Other SMTP” option (Email configuration).

Now, on the new server, where the only differences are the server name and IP address, I get this errro when I try to connect via TSL:  
Unable to connect with TLS encryption Log data: ++ Starting Swift\_SmtpTransport \<\< [220-node6237.myfcloud.com](http://220-node6237.myfcloud.com) ESMTP Exim 4.95 #2 Tue, 12 Apr 2022 13:38:14 +0000 220-We do not authorize the use of this system to transport unsolicited, 220 and/or bulk e-mail. \>\> EHLO dashboard.nsking.ee \<\< [250-node6237.myfcloud.com](http://250-node6237.myfcloud.com) Hello dashboard.nsking.ee [194.233.160.33] 250-SIZE 52428800 250-8BITMIME 250-PIPELINING 250-PIPE\_CONNECT 250-AUTH PLAIN LOGIN 250-STARTTLS 250 HELP \>\> STARTTLS \<\< 220 TLS go ahead !! Unable to connect with TLS encryption (code: 0) ++ Starting Swift\_SmtpTransport \<\< [220-node6237.myfcloud.com](http://220-node6237.myfcloud.com) ESMTP Exim 4.95 #2 Tue, 12 Apr 2022 13:38:14 +0000 220-We do not authorize the use of this system to transport unsolicited, 220 and/or bulk e-mail. \>\> EHLO dashboard.nsking.ee \<\< [250-node6237.myfcloud.com](http://250-node6237.myfcloud.com) Hello dashboard.nsking.ee [194.233.160.33] 250-SIZE 52428800 250-8BITMIME 250-PIPELINING 250-PIPE\_CONNECT 250-AUTH PLAIN LOGIN 250-STARTTLS 250 HELP \>\> STARTTLS \<\< 220 TLS go ahead !! Unable to connect with TLS encryption (code: 0)

When I connect via SSL I get this error:  
Connection could not be established with host [smtp.mailgun.org](http://smtp.mailgun.org) :stream\_socket\_client(): Peer certificate CN=`node6237.myfcloud.com' did not match expected CN=`[smtp.mailgun.org](http://smtp.mailgun.org)’ Log data: ++ Starting Swift\_SmtpTransport !! Connection could not be established with host [smtp.mailgun.org](http://smtp.mailgun.org) :stream\_socket\_client(): Peer certificate CN=`node6237.myfcloud.com' did not match expected CN=`[smtp.mailgun.org](http://smtp.mailgun.org)’ (code: 0)  
++ Starting Swift\_SmtpTransport !! Connection could not be established with host [smtp.mailgun.org](http://smtp.mailgun.org) :stream\_socket\_client(): Peer certificate CN=`node6237.myfcloud.com' did not match expected CN=`[smtp.mailgun.org](http://smtp.mailgun.org)’ (code: 0)

Mailgun and Fastcomet staff checked and everything is fine on their part. So, it must be something in Mautic’s code. What might be the issue? Thank you 🙂
