Forum

Configuration smtp ...
 
Notifications
Retirer tout

Configuration smtp mail without encryption

5 Posts
2 Utilisateurs
0 Reactions
5,430 Vu
ustas
(@ustas)
Posts: 3
Active Member
Début du sujet
 
[#3132]

Hello.

In version 5.2.4 practically impossible configure SMTP emailing without encryption.

If set login/pass, Projeqtor always enable encryption, nowise show this in the interface; this is very not trivial and it is just flat out confusing. This brings to that sort of errors, without any words of reason and status of enabled tls:

2016-03-02 20:37:37.531 ** ERROR ** Error sending mail
2016-03-02 20:37:37.532 ** ERROR **    SMTP Server :  10.0.1.1
2016-03-02 20:37:37.532 ** ERROR **    SMTP Port : 25
2016-03-02 20:37:37.532 ** ERROR **    Mail stored in Database : #21
2016-03-02 20:37:37.532 ** ERROR **    PHPMail error : SMTP connect() failed.  https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting 
2016-03-02 20:37:37.532 ** ERROR **    PHPMail debug :

Search of the forum not give result for me:

Ssl is not mandatory, just default if authentication is set and no protocolecspecified.
To specify other protocole, just enter it before host name :
tls://hostname
Sorry, but this is explained in the user manual.
RTFM 👿

TLS uses (in standard) port 587
Port 465 is for SSL protocole.

If you dont specify protocole in host definition, protocole will be guessed from port
25 : standard smtp (not encrypted)
465 : SSL
587 : TLS

If you want to force TLS (for instance if you use TLS on a non standard port) ust specify it on host definition
smtp server : tls://mail.xxx.xx

In contrast to forum's message above, in the .ppt manual explain what tls uses by default for 25 port. But not describe how to disable encryption.

I do not know php, but i am found two way to solve it:

1. Define the server address with ' ://' in config/parameters.php. This is not work if try set it in "Global parameters" page, probably, because the first char space removed at writing to base.

$paramMailSmtpServer = ' ://address';

2. Fix this bug in a projeqtor.php.

  if ($paramMailSmtpUsername and $paramMailSmtpPassword) {
    $phpmailer->SMTPAuth = true; // Enable SMTP authentication
    $phpmailer->Username = $paramMailSmtpUsername; // SMTP username
    $phpmailer->Password = $paramMailSmtpPassword; // SMTP password
    $phpmailer->SMTPSecure = 'tls'; // default (for ports 25 and 587
    if ($paramMailSmtpPort == '465')
      $phpmailer->SMTPSecure = 'ssl'; // 465 is default for ssl
    if (strpos ( $phpmailer->Host, '://' )) {
      $phpmailer->SMTPSecure = substr ( $phpmailer->Host, 0, strpos ( $phpmailer->Host, '://' ) );
      $phpmailer->Host = substr ( $phpmailer->Host, strpos ( $phpmailer->Host, '://' ) + 3 );
    }
  }

Replace line 947

    if (strpos ( $phpmailer->Host, '://' )) {

to, for example

    if (strpos ( $phpmailer->Host, '://' ) !== false) {

In that case to be work '://address' and setting on а "Global parameters" page. But, again, the user is not possible to guess this way is turned off encryption..

Thank for a projeqtor.

P.S.
line 936, // $phpmailer->SMTPDebug=1;
->
2016-03-02 20:37:37.532 ** ERROR ** PHPMail debug :

P.S.2
Lacking a button to send a test email to verify your settings. (Like a redmine/openproject)


 
Posté : 04/03/2016 2:35 pm
(@babynus)
Posts: 14952
Membre Admin
 

Thanks for your analysis

Fix will be included in V5.3.0 replacen lines from 947 :

    if (strpos ( $phpmailer->Host, '://' )!==false) {
      $phpmailer->SMTPSecure = substr ( $phpmailer->Host, 0, strpos ( $phpmailer->Host, '://' ) );
      if ($phpmailer->SMTPSecure=="smtp") $phpmailer->SMTPSecure="";
      $phpmailer->Host = substr ( $phpmailer->Host, strpos ( $phpmailer->Host, '://' ) + 3 );
    }

With this fix, it will be possible to enter "smtp://myhost" as host to send authentified non encryted emails.
But I would always advise to send encrpyted emails B)

Idea of button to test email is good.
Request recorded as Ticket #1997


 
Posté : 05/03/2016 1:23 am
ustas
(@ustas)
Posts: 3
Active Member
Début du sujet
 

Thank you.

But I would always advise to send encrpyted emails B)

Undoubtedly, but i have no control over the mail server.

line 936, // $phpmailer->SMTPDebug=1;
->
2016-03-02 20:37:37.532 ** ERROR ** PHPMail debug :

You do not enable the print of value "PHPMail debug"? Current message is empty.


 
Posté : 09/03/2016 7:28 pm
(@babynus)
Posts: 14952
Membre Admin
 

if ($logLevel>='3') $phpmailer->SMTPDebug=1;

You're right, will give possibility to enable in V5.3 :

if ($logLevel>='3') $phpmailer->SMTPDebug=1;

 
Posté : 10/03/2016 4:01 pm
ustas
(@ustas)
Posts: 3
Active Member
Début du sujet
 

OK. Thanks.


 
Posté : 10/03/2016 7:05 pm
Share:
Retour en haut