# WHMCS smtp via TLS

**URL:** <https://forums.interworx.com/t/whmcs-smtp-via-tls/14207>\
**Category:** General Discussion\
**Tags:** whmcs, smtp, tls, starttls\
**Created:** [July 26, 2017, 2:17am UTC](https://forums.interworx.com/t/whmcs-smtp-via-tls/14207 "2017-07-26T02:17:58Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![mdeinhardt](https://forums.interworx.com/user_avatar/forums.interworx.com/mdeinhardt/32/34_2.png) [@mdeinhardt](https://forums.interworx.com/u/mdeinhardt)\
**Post date:** [July 26, 2017, 2:17am UTC](https://forums.interworx.com/t/whmcs-smtp-via-tls/14207/1 "2017-07-26T02:17:58Z")

</div>

Hi all,

to the other WHMCS users out there, what settings are you using for SMTP? I have been trying to gte TLS to work, but without luck. Enabling $smtp\_debug=‘true’; in config.php I see this:

> 2017-07-26 08:54:21 Connection: opening to localhost:25, timeout=300, options=array ( )  
> 2017-07-26 08:54:21 Connection: opened  
> 2017-07-26 08:54:21 SMTP -\> get\_lines(): $data is “”  
> 2017-07-26 08:54:21 SMTP -\> get\_lines(): $str is "220 [mail.domain.com](http://mail.domain.com) company Mailserver ESMTP "  
> 2017-07-26 08:54:21 SERVER -\> CLIENT: 220 [mail.domain.com](http://mail.domain.com) company Mailserver ESMTP  
> 2017-07-26 08:54:21 CLIENT -\> SERVER: EHLO company  
> 2017-07-26 08:54:21 SMTP -\> get\_lines(): $data is “”  
> 2017-07-26 08:54:21 SMTP -\> get\_lines(): $str is "[250-mail.domain.com](http://250-mail.domain.com) company Mailserver "  
> 2017-07-26 08:54:21 SMTP -\> get\_lines(): $data is "[250-mail.domain.com](http://250-mail.domain.com) company Mailserver "  
> 2017-07-26 08:54:21 SMTP -\> get\_lines(): $str is "250-AUTH LOGIN PLAIN "  
> 2017-07-26 08:54:21 SMTP -\> get\_lines(): $data is "[250-mail.domain.com](http://250-mail.domain.com) company Mailserver 250-AUTH LOGIN PLAIN "  
> 2017-07-26 08:54:21 SMTP -\> get\_lines(): $str is "250-AUTH=LOGIN PLAIN "  
> 2017-07-26 08:54:21 SMTP -\> get\_lines(): $data is "[250-mail.domain.com](http://250-mail.domain.com) company Mailserver 250-AUTH LOGIN PLAIN 250-AUTH=LOGIN PLAIN "  
> 2017-07-26 08:54:21 SMTP -\> get\_lines(): $str is "250-STARTTLS "  
> 2017-07-26 08:54:21 SMTP -\> get\_lines(): $data is "[250-mail.domain.com](http://250-mail.domain.com) company Mailserver 250-AUTH LOGIN PLAIN 250-AUTH=LOGIN PLAIN 250-STARTTLS "  
> 2017-07-26 08:54:21 SMTP -\> get\_lines(): $str is "250-SIZE 52428800 "  
> 2017-07-26 08:54:21 SMTP -\> get\_lines(): $data is "[250-mail.domain.com](http://250-mail.domain.com) company Mailserver 250-AUTH LOGIN PLAIN 250-AUTH=LOGIN PLAIN 250-STARTTLS 250-SIZE 52428800 "  
> 2017-07-26 08:54:21 SMTP -\> get\_lines(): $str is "250-PIPELINING "  
> 2017-07-26 08:54:21 SMTP -\> get\_lines(): $data is "[250-mail.domain.com](http://250-mail.domain.com) company Mailserver 250-AUTH LOGIN PLAIN 250-AUTH=LOGIN PLAIN 250-STARTTLS 250-SIZE 52428800 250-PIPELINING "  
> 2017-07-26 08:54:21 SMTP -\> get\_lines(): $str is "250 8BITMIME "  
> 2017-07-26 08:54:21 SERVER -\> CLIENT: [250-mail.domain.com](http://250-mail.domain.com) company Mailserver 250-AUTH LOGIN PLAIN 250-AUTH=LOGIN PLAIN 250-STARTTLS 250-SIZE 52428800 250-PIPELINING 250 8BITMIME  
> 2017-07-26 08:54:21 CLIENT -\> SERVER: STARTTLS  
> 2017-07-26 08:54:21 SMTP -\> get\_lines(): $data is “”  
> 2017-07-26 08:54:21 SMTP -\> get\_lines(): $str is "220 ready for tls "  
> 2017-07-26 08:54:21 SERVER -\> CLIENT: 220 ready for tls  
> 2017-07-26 08:54:21 SMTP Error: Could not connect to SMTP host.  
> 2017-07-26 08:54:21 CLIENT -\> SERVER: QUIT  
> 2017-07-26 08:54:21 SMTP -\> get\_lines(): $data is “”  
> 2017-07-26 08:54:21 SMTP -\> get\_lines(): $str is “”  
> 2017-07-26 08:54:21 SERVER -\> CLIENT:  
> 2017-07-26 08:54:21 SMTP ERROR: QUIT command failed:  
> 2017-07-26 08:54:21 Connection: closed  
> 2017-07-26 08:54:21 SMTP Error: Could not connect to SMTP host.  
> Email Sending Failed - SMTP Error: Could not connect to SMTP host.

But that only tells me, that the server is ready for TLS and that the client “couldn’t connect” As soon as I disable TLS (i.e. send unencrypted) it works. That means all other settings are fine (8 bit encoding, hostname, user, password).  
Is anybody using TLS in WHMCS with an Interworx mailserver?

Cheers,  
Michael

---

<div class="post-metadata">

**Author:** ![d2d4j](https://forums.interworx.com/user_avatar/forums.interworx.com/d2d4j/32/16_2.png) [@d2d4j](https://forums.interworx.com/u/d2d4j)\
**Post date:** [July 26, 2017, 3:01am UTC](https://forums.interworx.com/t/whmcs-smtp-via-tls/14207/2 "2017-07-26T03:01:39Z")

</div>

Hi Michael

Hope alls well

I think your issue maybe port 587 is not open in IW firewall

You can delete and add port 587 back into firewall and check (I do know a little while back port 587 was shown as open in firewall, but tests showed this was not open and tls failed)

Please remember qmail/sendmail first start on port 25, then upgrades to 587, before any information is passed and when I’m back later, could find my posts re tls smtp

I hope that helps

Many thanks

John

---

<div class="post-metadata">

**Author:** ![mdeinhardt](https://forums.interworx.com/user_avatar/forums.interworx.com/mdeinhardt/32/34_2.png) [@mdeinhardt](https://forums.interworx.com/u/mdeinhardt)\
**Post date:** [July 26, 2017, 4:16am UTC](https://forums.interworx.com/t/whmcs-smtp-via-tls/14207/3 "2017-07-26T04:16:15Z")

</div>

Hi John,

I am fine, thanks. And you? Workload a bit better?

I did check the firewall before, but I followed your advice and deleted and re-added port 587. Unfortunately no luck ☹  
And I tried port 25 as well as 587. Both work from my mailclient with TLS, so it must be related to WHMCS.

Cheers,  
Michael

---

<div class="post-metadata">

**Author:** ![d2d4j](https://forums.interworx.com/user_avatar/forums.interworx.com/d2d4j/32/16_2.png) [@d2d4j](https://forums.interworx.com/u/d2d4j)\
**Post date:** [July 26, 2017, 5:00am UTC](https://forums.interworx.com/t/whmcs-smtp-via-tls/14207/4 "2017-07-26T05:00:01Z")

</div>

Hi Michael

Yes, well thanks, apart from a tooth abscess and grandchildren stopping for a few weeks

Sorry, whmcs did not register in my 1 brain cell

Is whmcs on the same server or different server

Are you using whmcs 7.2.3 I think been the latest

The issue looks likely to be no matching ciphers to use perhaps, given that client start tls and server responds with tls ready. Therefore the next sequence is to try to agree ciphers. If no ciphers can be agreed, the connection fails. Which is what looks to be happening from your excerpt

I could be wrong though sorry and will look at our whmcs when I’m back later

Many thanks

John

---

<div class="post-metadata">

**Author:** ![mdeinhardt](https://forums.interworx.com/user_avatar/forums.interworx.com/mdeinhardt/32/34_2.png) [@mdeinhardt](https://forums.interworx.com/u/mdeinhardt)\
**Post date:** [July 26, 2017, 5:22am UTC](https://forums.interworx.com/t/whmcs-smtp-via-tls/14207/5 "2017-07-26T05:22:16Z")

</div>

Yep, same server, latest version 7.2.3.

The tooth thing has been going on for some while now, hasn’t it? I wish you fast recovery…

---

<div class="post-metadata">

**Author:** ![d2d4j](https://forums.interworx.com/user_avatar/forums.interworx.com/d2d4j/32/16_2.png) [@d2d4j](https://forums.interworx.com/u/d2d4j)\
**Post date:** [July 26, 2017, 12:38pm UTC](https://forums.interworx.com/t/whmcs-smtp-via-tls/14207/6 "2017-07-26T12:38:20Z")

</div>

Hi Michael

Many thanks, much appreciated

I have had a quick look and test on our whmcs, and I believe I may have found your issue

On your smtp server address line, I’m thinking you are using mail.yourdomain.url of your whmcs

In qmail/sendmail, it will not show as trusted, and usually in email client setup, you see the accept untrusted domain

If you change the smtp server address to your IW domain, as shown in ssl of IW-cp ssl certs, and leave all other details as you have set, save and test.

This should then work lovely as the ssl on tls is correct

I hope that makes sense and helps a little

Many thanks

John

---

<div class="post-metadata">

**Author:** ![mdeinhardt](https://forums.interworx.com/user_avatar/forums.interworx.com/mdeinhardt/32/34_2.png) [@mdeinhardt](https://forums.interworx.com/u/mdeinhardt)\
**Post date:** [July 27, 2017, 1:36am UTC](https://forums.interworx.com/t/whmcs-smtp-via-tls/14207/7 "2017-07-27T01:36:41Z")

</div>

You, Sir, are a genius 😉

I actually had “localhost” there and it never crossed my mind that that line ever would serve more than just “where to find the smtp server”.

Thank you very much - as always!

---

<div class="post-metadata">

**Author:** ![d2d4j](https://forums.interworx.com/user_avatar/forums.interworx.com/d2d4j/32/16_2.png) [@d2d4j](https://forums.interworx.com/u/d2d4j)\
**Post date:** [July 27, 2017, 1:41am UTC](https://forums.interworx.com/t/whmcs-smtp-via-tls/14207/8 "2017-07-27T01:41:38Z")

</div>

Hi Michael

Glad it resolved it for you.

I kinda think sometimes we cannot see the woods for the trees, so it often helps to ask. Mind you, I do need to call at spec savers - been blind and deaf according to my granddaughter haha

Many thanks

John
