1

Topic: Send Email from CakePHP web application over SMTP via iRedMail error

==== Required information ====
- iRedMail version (check /etc/iredmail-release):
- Linux/BSD distribution name and version:
- Store mail accounts in which backend (LDAP/MySQL/PGSQL):
- Web server (Apache or Nginx):
- Manage mail accounts with iRedAdmin-Pro?
- Related log if you're reporting an issue:
======== Required information ====
- iRedMail version (check /etc/iredmail-release): 0.9.2
- Linux/BSD distribution name and version: CentOS release 6.7 (Final)
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): Apache 2.2.15
- Manage mail accounts with iRedAdmin-Pro? Nope
- Related log if you're reporting an issue: Down below
====

Hi guys,
I run CakePHP with Email-transport SMTP:
In app.php
'EmailTransport' => [
        'default' => [
            'className' => 'Smtp',
            // The following keys are used in SMTP transports
            'host' => 'smtp.domain.tld', (I´ve set my domain here)
            'port' => 25, (left this 25 as in Thunderbird it works with 25)
            'timeout' => 30,
            'username' => 'username', (yes, I set this)
            'password' => 'password', (this also)
            'client' => null,
            'tls' => true, (I set this to true)
        ],
    ],
The exact settings are working with Thunderbird, there I can send and receive mails flawlessly.

When registering a user internally a confirmation mail is sent via CakePHP but the app tells me this error:
SMTP server did not accept the connection or trying to connect to non TLS SMTP server using TLS.

I use the standard installation of iRedMail which runs fine aside my problem.
/var/log/maillog delivers:
Oct  2 17:57:23 v22015093023528042 postfix/smtpd[1930]: connect from 123.456.789.0.pools.vodafone-ip.de[1$
Oct  2 17:57:24 v22015093023528042 postfix/smtpd[1930]: lost connection after STARTTLS from 123.456.789.0$
Oct  2 17:57:24 v22015093023528042 postfix/smtpd[1930]: disconnect from 123.456.789.0.pools.vodafone-ip.d$

I tried it already with roundcube config.inc.php:
// SMTP
$config['smtp_server'] = 'tls://domain.tld';
instead of "tls://127.0.0.1"
Not working

Then I tried to open TLS1 and 1.1 in /etc/postfix/main.cf:
smtpd_tls_mandatory_protocols = !SSLv2,!SSLv3,!TLSv1,!TLSv1.1
smtpd_tls_protocols=!SSLv2,!TLSv1,!TLSv1.1,!SSLv3
Not working.

Now I don´t have a clue what to do. Thanks in advance smile

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Send Email from CakePHP web application over SMTP via iRedMail error

Does it work with port 587?

3

Re: Send Email from CakePHP web application over SMTP via iRedMail error

Hi Zhang, unfortunately that doesn´t work. Same error.

4

Re: Send Email from CakePHP web application over SMTP via iRedMail error

Can you send email with other mail client applications like Thunderbird, outlook? If yes, I'm afraid that you'd better check CakePHP document or ask support from CakePHP instead.

5

Re: Send Email from CakePHP web application over SMTP via iRedMail error

Yes, with Thunderbird it´s working.
I tried it with the userdata of my other mail server (managed server) and with them Cake 3.X sends the mails like a charm. But only when I set the tls option to null.
For iRedMail, when I set tls to null Cake throws:
SMTP Error: 503 5.5.1 Error: authentication not enabled
So I assume iRedMail has to be configured to either ignore TLS or use it properly (TLS is better than no security so it would be better to sort things out with it).
What do I have to tell iRedMail and in which file(s)?

6

Re: Send Email from CakePHP web application over SMTP via iRedMail error

With default iRedMail settings, client is forced to use TLS for secure connection. So please enable TLS in your PHP code.

Or, the NOT recommended solution:
http://www.iredmail.org/docs/allow.inse … tions.html

Again, please always use TLS/SSL for secure connection.

7

Re: Send Email from CakePHP web application over SMTP via iRedMail error

OK, so when I comment out "smtpd_tls_auth_only=yes" in "/etc/postfix/main.cf" and say Cake to not use TLS then it works. If I tell Cake and iRedMail to use TLS it doesn´t with showing the errors I mentioned. Is it really a Cake problem or a config problem of my iRedMail? Because Mark Story, lead dev of Cake, said he tested TLS it with postfix and it worked ... See 2/3 of page: https://github.com/cakephp/cakephp/issues/6511 Is it possible the self signed SSL cert is the problem here?

8

Re: Send Email from CakePHP web application over SMTP via iRedMail error

OK, it´s a Cake-problem. Cake doesn´t support self signed SSL certificates as of yet. Mark Story told this to me: https://github.com/cakephp/cakephp/issues/7505

9

Re: Send Email from CakePHP web application over SMTP via iRedMail error

Self-signed ssl cert is quite normal, and should be easy to support, maybe you should push them to implement this.