Forum

Unable to setup an ...
 
Notifications
Retirer tout

Unable to setup an SMTP on dockerized install

9 Posts
2 Utilisateurs
0 Reactions
4,754 Vu
 LSM
(@itconvexum-fr)
Posts: 6
Active Member
Début du sujet
 
[#7155]

HI, 

First thanks for the high quality of the software.

I have for test setup an install of the latest version 9.0.1 based on on the image: lavoweb/php-7.4. I can share if you want the docker-compose but I think that it is not really relevant.

I can not make the smtp section working (no email sent). My constraints are : 
SMTP with 587 to smept.ionos.fr
Login + passwords (containing char like %ù)

I tried the 3 options : 
- PHPMailer : 
The test function is indicating : 
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

and the logs are showing :2021-01-04 22:32:37.334 ** ERROR ** [V9.0.1] Error sending mail2021-01-04 22:32:37.334 ** ERROR ** [V9.0.1]    SMTP Server : localhost2021-01-04 22:32:37.334 ** ERROR ** [V9.0.1]    SMTP Port : 252021-01-04 22:32:37.334 ** ERROR ** [V9.0.1]    Mail stored in Database : #332021-01-04 22:32:37.334 ** ERROR ** [V9.0.1]    PHPMail error : SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting2021-01-04 22:32:37.334 ** ERROR ** [V9.0.1]    PHPMail debug :- PHPMail indicate a success

- direct socket failed directly.

I try to bind it to a local (ie lan) smtpd with these 3 configurations (even with an open relay), but I did not get any success.  I expect the problem to be in the docker image and not on the software but I am quite surprised to not have logs of the two options.

I know that docker is not supported but I am looking for some options to follow up this issue. One main way would be to implement the SMTPDebug = SMTP::DEBUG_SERVER of PHPMailer (indicated in one thread on previous version) but I did not find were to enable it. 

Thanks in advance,


 
Posté : 05/01/2021 1:26 am
(@babynus)
Posts: 14952
Membre Admin
 

Your connection fails with (as written is the log)
SMTP Server : localhost
SMTP Port : 25

It'n not what you expect.
Possibly you have extra data in parameters.php that ovewrites DB parameters.
Try and remove all SMTP parameters from parameter.php file.


 
Posté : 05/01/2021 2:38 am
 LSM
(@itconvexum-fr)
Posts: 6
Active Member
Début du sujet
 

Hu Babynus,

Thanks for your quick answer !
I dig into that and the things seems a bit more complex than expected.
I have remove the credential of the user to avoid any problem.

I can, from the docker, check that :
- sendmail is okay (existing using EXIM4).
- the EXIM package is not configured (expected as it is a docker)
- if I configure it in the docker, it is working fine locally (that will be my solution I think)

However, from a clean docker (i.e. no EXIM configured), whatever the configuration of projetqtor, it is impossible to send an email. I check that, from the docker even with the not configured EXIM, a remote smtp enabled mail (s-nail) MTA is okay to send email (i.e. I can connect to the smtp server and send the email).

I am a bit puzzled by that because all the proposed option (PHPMailer, PHPmail and direct socket) should be able to connect to the SMTP server directly. I still have errors just as they are trying to go using the local EXIM configuration.

I understand that my configuration is not really typical but I can try to provide you more data if you want.

How can I help to look into that and to provide you some information ?

Thanks !


 
Posté : 09/01/2021 4:46 am
 LSM
(@itconvexum-fr)
Posts: 6
Active Member
Début du sujet
 

Sorry I forgot to add that I have removed the parameters relating to SMTP that were left in the parameter.php and the logs is pointing that the address is now correct. Yet I still have the same issue on the SMTP.

The log is now : 2021-01-09 02:52:19.927 ** ERROR ** [V9.0.1] Error sending mail2021-01-09 02:52:19.927 ** ERROR ** [V9.0.1]    SMTP Server : postfix.pub_net2021-01-09 02:52:19.927 ** ERROR ** [V9.0.1]    SMTP Port : 252021-01-09 02:52:19.927 ** ERROR ** [V9.0.1]    Mail stored in Database : #1262021-01-09 02:52:19.927 ** ERROR ** [V9.0.1]    PHPMail error : SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting2021-01-09 02:52:19.927 ** ERROR ** [V9.0.1]    PHPMail debug :

The postfix address is resolving : 

 root@040029cc484e:/var/www/html/files# ping postfix.pub_netPING postfix.pub_net (10.30.10.15) 56(84) bytes of data.64 bytes from postfix.pub_net (10.30.10.15): icmp_seq=1 ttl=64 time=0.062 ms64 bytes from postfix.pub_net (10.30.10.15): icmp_seq=2 ttl=64 time=0.067 ms64 bytes from postfix.pub_net (10.30.10.15): icmp_seq=3 ttl=64 time=0.064 ms

and the direct delivery on the port 25 is okay (telnet cheked + email using s-nail). 

Voici le parameter.php : 

 <?php// =======================================================================================// Automatically generated parameter file// =======================================================================================$paramDbType = 'XXX;$paramDbHost = 'XXX;$paramDbPort = '3306';$paramDbUser =XXXX$paramDbPassword = XXXXX$paramDbName = 'projeqtor';$paramDbDisplayName = 'ProjeQtOr';$paramDbPrefix = '';$SslKey = '';$SslCert = '';$SslCa = '';$paramLdap_allow_login = 'false';$paramLdap_base_dn = 'dc=mydomain,dc=com';$paramLdap_host = 'localhost';$paramLdap_port = '389';$paramLdap_version = '3';$paramLdap_search_user = 'cn=Manager,dc=mydomain,dc=com';$paramLdap_search_pass = 'secret';$paramLdap_user_filter = 'uid=%USERNAME%';//$paramMailSmtpServer = 'localhost';//$paramMailSmtpPort = '25';$paramMailSendmailPath = '';$paramPasswordMinLength = '5';$paramDefaultLocale = 'fr';$paramDefaultTimezone = 'Europe/Paris';$currency = '€';$currencyPosition = 'after';$paramAttachmentDirectory = '../files/attach/';$documentRoot = '../files/documents/';$paramAttachmentMaxSize = '10485760';$AttachmentMaxSizeMail = '2097152';$paramReportTempDirectory = '../files/report/';$paramMemoryLimitForPDF = '512';$logFile = '../files/logs/projeqtor_${date}.log';$logLevel = '2';

 


 
Posté : 09/01/2021 5:04 am
(@babynus)
Posts: 14952
Membre Admin
 

Please post the connection error message that is logged on projeqtor log file


 
Posté : 09/01/2021 6:52 pm
 LSM
(@itconvexum-fr)
Posts: 6
Active Member
Début du sujet
 

Hi, 

First, I checked that from the docker, I can reach the postfix machine and port and send emails : 

root@d67a6a8d00c5:/var/www/html# s-nail -v -s "Test email" -S smtp=smtp://postfix.pub_net -S from="xx@xxxx.xx" xx@xxxxxx.xxTest.Resolving host "postfix.pub_net:smtp" ... doneConnecting to "10.30.10.1:smtp" ...connected.

And the email has reached the mailbox. So the configuration is working. Here are the logs requested : 

  • configuration "connexion direct socket" : 
    • Success reported
    • Non mail received
    • No logs on the files/logs
    • No logs (no connection) from postfix side

 

  • Configuration PHPMailer
    • Error reported : SMTP connect() failed. 
    • Non mail received
    • Logs on the files/logs : 

2021-01-10 21:22:26.312 ** ERROR ** [V9.0.1] Error sending mail
2021-01-10 21:22:26.312 ** ERROR ** [V9.0.1]    SMTP Server : postfix.pub_net
2021-01-10 21:22:26.312 ** ERROR ** [V9.0.1]    SMTP Port : 25
2021-01-10 21:22:26.312 ** ERROR ** [V9.0.1]    Mail stored in Database : #138
2021-01-10 21:22:26.312 ** ERROR ** [V9.0.1]    PHPMail error : SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
2021-01-10 21:22:26.312 ** ERROR ** [V9.0.1]    PHPMail debug : 

    • No logs (no connection) from postfix side
  • configuration "PHPMail" : 
    • Success reported
    • Non mail received
    • No logs on the files/logs
    • No logs (no connection) from postfix side

I confirm that the $parameter.php is : 

$paramLdap_user_filter = 'uid=%USERNAME%';
//$paramMailSmtpServer = 'localhost';
//$paramMailSmtpPort = '25';
//$paramMailSendmailPath = '';

$paramPasswordMinLength = '5';
$paramDefaultLocale = 'fr';

I can delete the lines but I kept it for now. Let me know but I think that the // will void the lines.

To answer your query, I checked that the software sendmail is existing in the docker: 

root@3bf5e5927c46:/var/www/html# sendmailExim is a Mail Transfer Agent. It is normally called by Mail User Agents,not directly from a shell command line. Options and/or arguments controlwhat it does when called. For a list of options, see the Exim documentation.

 When I add the sendmail path : /usr/sbin/sendmail, boht PHPMailer and PHPMail indicate a success but no email is sent. Same with /usr/sbin/. no error is indcated in the logs. I tried also to install and inidcate the mailx package, same results. 

In fact, the mail sent indication is positive whatever directory is indicated. Even non existing directory. No logs are generated in that case.  No email are sent.  I find this quite strange so I tried ot localize the function in the source code but I failed to find it.  Best regards, 
 


 
Posté : 11/01/2021 12:28 am
(@babynus)
Posts: 14952
Membre Admin
 

 When I add the sendmail path : /usr/sbin/sendmail, boht PHPMailer and PHPMail indicate a success but no email is sent. Same with /usr/sbin/. no error is indcated in the logs. I tried also to install and inidcate the mailx package, same results. 

You should enter senmail path only for local smtp. Your is remote (not on current server)

I think your configuration does not allow smtp though speficied port, or possibly your server requires an authentication for remote mailing.
Try wih IP of smtp server instead of name (will avoir name resolution issue)
Try with authentication.
Check on smtp server if it receives the connection.
 


 
Posté : 11/01/2021 1:40 pm
 LSM
(@itconvexum-fr)
Posts: 6
Active Member
Début du sujet
 

Hi babynus, 

You should enter senmail path only for local smtp. Your is remote (not on current server)

Okay noted. thansk for the information.

I think your configuration does not allow smtp though speficied port, or possibly your server requires an authentication for remote mailing.

I tried the telnet on port 25 from the docker and it is working fine. 

I checked that by email directly from the docker using "remote smtp enabled" sendmail (s-nail) : so from the docker container I am able to send the email to my smtp and everything is okay. at this test, I tried at that stage both IP and name.

I did not try from the interface and I will let you know.

I have tried :

  • LAN located SMTP with open relay configuration results : 
  • LAN located SMTP with open relay and no auth 
  • WAN located SMTP (office 365 and inios account, no very confident on the office 365...) with auth

All test were conducted from :
 -  the interface (with all the options PHPMailer / PHP Mail / Direct socket) 
 - the docker itself with s-mail as interface for authetificated SMTP
 - tenel port 25 for unauth local SMTP

All the tests conducted from the docker  were positive (email sent, email received, logs on the LAN SMTP).

From the interface : some options reported positive results but no email were receied whatever the test made. To summarized it : no email sent no connection to the SMTP (no error either) operated locally and no email sent.  

I am guessing that the problem is coming from the apache / php  stack up. 

Is there a way to generate an email using the php framework to test that idea ? I can probably be more specific on the error localization with that. 

Best regards, 

 


 
Posté : 13/01/2021 1:09 am
 LSM
(@itconvexum-fr)
Posts: 6
Active Member
Début du sujet
 

HI!

It tooks me some time to figure it out because from the docker VM it is working fine to connect to the SMTP but from projetqor it seems that it is not with the IP hardcoded for the SMTP, it works very well with PHPMailer.

So you were right about the name resolution !

It is not however working for the two other options (PHPMail and direct socket). I checked on the SMTP no incoming connections in that case. Not sure how I could help for that and maybe you are not interested in this corner case. 

If you want and if you are interested I can share with you the docker-compose and the docker procedure / architecture. 

Best regards, 

 


 
Posté : 15/01/2021 12:49 pm
Share:
Retour en haut