Notifications Mails Jorani...

243 views
Skip to first unread message

Vincent Troussard

unread,
Jul 28, 2022, 9:57:14 AM7/28/22
to jorani
Bonjour,

Les notifications Jorani sont habituellement envoyées par mail. Notre serveur de messagerie est de type Exchange hébergé en Microsoft 365.
Depuis la modification de la sécurité des serveurs Exchange les notifications ne sont plus envoyées.

Le fichier email.php est renseigné comme ci-dessous :

<?php defined('BASEPATH') OR exit('No direct script access allowed.');

$config['useragent'] = 'PHPMailer';
$config['protocol'] = 'smtp';
$config['mailpath'] = '/usr/sbin/sendmail';
$config['smtp_host'] = 'smtp.office365.com';
$config['_smtp_auth'] = TRUE;
$config['smtp_user'] = '********@********.fr';
$config['smtp_pass'] = '************';
$config['smtp_port'] = '587';
$config['smtp_timeout'] = '30';
$config['smtp_crypto'] = 'tls';
$config['smtp_debug'] = 0;
$config['smtp_auto_tls'] = FALSE;
$config['smtp_conn_options'] = array();
$config['wordwrap'] = TRUE;
$config['wrapchars'] = 76;
$config['mailtype'] = 'html';
$config['charset'] = 'UTF-8';
$config['validate'] = TRUE;
$config['wordwrap'] = FALSE;
$config['wrapchars'] = 70;
$config['validate'] = FALSE;
$config['priority'] = 3;
$config['crlf'] = "\n";
$config['newline'] = "\n";
$config['bcc_batch_mode'] = FALSE;
$config['bcc_batch_size'] = 200;
$config['encoding'] = '8bit';

Voici ce que m'envoie testemail.php

Test of your e-mail configuration
INFO: Selecting SMTP Protocol.
INFO: SMTP with authentication.
INFO: SMTP with crypto.
 SERVER -> CLIENT: 220 PR0P264CA0140.outlook.office365.com Microsoft ESMTP MAIL Service ready at Thu, 28 Jul 2022 13:36:55 +0000
 CLIENT -> SERVER: EHLO localhost
 SERVER -> CLIENT: 250-PR0P264CA0140.outlook.office365.com Hello [xxx.xxx.xxx.xxx]
 250-SIZE 157286400
 250-PIPELINING
 250-DSN
 250-ENHANCEDSTATUSCODES
 250-STARTTLS
 250-8BITMIME
 250-BINARYMIME
 250-CHUNKING
 250 SMTPUTF8
 CLIENT -> SERVER: STARTTLS
 SERVER -> CLIENT: 220 2.0.0 SMTP server ready
 CLIENT -> SERVER: EHLO localhost
 SERVER -> CLIENT: 250-PR0P264CA0140.outlook.office365.com Hello [xxx.xxx.xxx.xxx]
 250-SIZE 157286400
 250-PIPELINING
 250-DSN
 250-ENHANCEDSTATUSCODES
 250-AUTH LOGIN XOAUTH2
 250-8BITMIME
 250-BINARYMIME
 250-CHUNKING
 250 SMTPUTF8
 CLIENT -> SERVER: AUTH LOGIN
 SERVER -> CLIENT: 334 VXNlcm5hbWU6
 CLIENT -> SERVER: YXBhcy5jb25nZXNAYXBhczE3LmZy
 SERVER -> CLIENT: 334 UGFzc3dvcmQ6
 CLIENT -> SERVER: YXBhX0FwYXNKb3JhbmkxNzMwMA==
 SERVER -> CLIENT: 421 4.7.66 TLS 1.0 and 1.1 are not supported. Please upgrade/update your client to support TLS 1.2. Visit https://aka.ms/smtp_auth_tls. [PR0P264CA0140.FRAP264.PROD.OUTLOOK.COM]
 SMTP ERROR: Password command failed: 421 4.7.66 TLS 1.0 and 1.1 are not supported. Please upgrade/update your client to support TLS 1.2. Visit https://aka.ms/smtp_auth_tls. [PR0P264CA0140.FRAP264.PROD.OUTLOOK.COM]
 SMTP Error: Could not authenticate.CLIENT -> SERVER: QUIT
 SERVER -> CLIENT: SMTP ERROR: QUIT command failed: SMTP Error: Could not authenticate.ERROR: PHPMailer has encountered an error.
SMTP Error: Could not authenticate.

Troubleshooting

In case of error, here are some additional steps:
•Check the configuration with your IT Admin team.
•If you are using GMAIL, please read this article.
•The STMP port may be blocked by your organization/server's security policy (firewall, etc.).
•When running SELinux, the webserver is blocked by default (it cannot send e-mails or open a network connection). Please consider unblocking it:

$ setsebool -P httpd_can_sendmail 1
$ setsebool -P httpd_can_network_connect 1

•Some e-mail servers (eg Office 360) require to set a valid sender e-mail. Update config/config.php
$config['from_mail'] = 'do....@reply.me';

•Some antivirus block STMP port by default.
•Some SMTP server require the application server sending emails (i.e. Jorani) to be whitelisted (on the SMTP server).
•Your webhosting company may forbid email functions.
•Maybe that the emails are sent but put into SPAM folder.


Le mot de passe de la boîte aux lettres est bien le bon. J'ai refais tout le tour de la configuration, je ne vois pas ce qui peut bloquer.

Philippe Mignon

unread,
Jul 29, 2022, 8:21:48 AM7/29/22
to jorani
Bonjour,
le mode TLS n'est pas sécurisé il me semble, j'utilise de mon côté le SSL sur le port 465
Autre détail, vous spécifiez 2 fois la variable $config['wrapchars'] , avec 70 et 76
je ne pense pas que cela gêne, je fait la coupure à 76 de mon côté
cdlt

<?php defined('BASEPATH') OR exit('No direct script access allowed.');

$config['useragent']        = 'PHPMailer';              // Mail engine switcher: 'CodeIgniter' or 'PHPMailer'
$config['protocol']         = 'smtp';                   // 'mail', 'sendmail', or 'smtp'
$config['mailpath']         = '/usr/sbin/sendmail';
$config['smtp_host']        = 'ssl0.ovh.net';
$config['smtp_auth']        = null;                     // Whether to use SMTP authentication, boolean TRUE/FALSE. If this option is omited or if it is NULL, then SMTP authentication is used when both $config['smtp_user'] and $config['smtp_pass'] are non-empty strings.
$config['smtp_user']        = 'x...@xxxxxxx.xx';
$config['smtp_pass']        = 'xxxxx';
$config['smtp_port']        = 465;
$config['smtp_timeout']     = 30;                       // (in seconds)
$config['smtp_crypto']      = 'ssl';                       // '' or 'tls' or 'ssl'
$config['smtp_debug']       = 0;                        // PHPMailer's SMTP debug info level: 0 = off, 1 = commands, 2 = commands and data, 3 = as 2 plus connection status, 4 = low level data output.
$config['smtp_auto_tls']    = FALSE;                     // Whether to enable TLS encryption automatically if a server supports it, even if `smtp_crypto` is not set to 'tls'.
$config['smtp_conn_options'] = array();                 // SMTP connection options, an array passed to the function stream_context_create() when connecting via SMTP.

$config['wordwrap']         = TRUE;
$config['wrapchars']        = 76;
$config['mailtype']         = 'html';                   // 'text' or 'html'
$config['charset']          = 'UTF-8';                  // 'UTF-8', 'ISO-8859-15', ...; NULL (preferable) means config_item('charset'), i.e. the character set of the site.
$config['validate']         = TRUE;
$config['priority']         = 3;                        // 1, 2, 3, 4, 5; on PHPMailer useragent NULL is a possible option, it means that X-priority header is not set at all, see https://github.com/PHPMailer/PHPMailer/issues/449
$config['crlf']             = "\n";                     // "\r\n" or "\n" or "\r"
$config['newline']          = "\n";                     // "\r\n" or "\n" or "\r"

$config['bcc_batch_mode']   = FALSE;
$config['bcc_batch_size']   = 200;
$config['encoding']         = '8bit';                   // The body encoding. For CodeIgniter: '8bit' or '7bit'. For PHPMailer: '8bit', '7bit', 'binary', 'base64', or 'quoted-printable'.

// DKIM Signing
// See https://yomotherboard.com/how-to-setup-email-server-dkim-keys/
// See http://stackoverflow.com/questions/24463425/send-mail-in-phpmailer-using-dkim-keys
// See https://github.com/PHPMailer/PHPMailer/blob/v5.2.14/test/phpmailerTest.php#L1708
$config['dkim_domain']      = '';                       // DKIM signing domain name, for exmple 'example.com'.
$config['dkim_private']     = '';                       // DKIM private key, set as a file path.
$config['dkim_private_string'] = '';                    // DKIM private key, set directly from a string.
$config['dkim_selector']    = '';                       // DKIM selector.
$config['dkim_passphrase']  = '';                       // DKIM passphrase, used if your key is encrypted.
$config['dkim_identity']    = '';                       // DKIM Identity, usually the email address used as the source of the email.

Vincent Troussard

unread,
Jul 29, 2022, 11:06:44 AM7/29/22
to jorani
Merci Philippe pour ta contribution,

Je me suis permis d'utiliser ton ficher email.php en changeant tes informations par mes identifiants Gmail.

Voilà ce que j'obtiens, que se soit en TLS (587) ou SSL (465).

Test of your e-mail configuration

INFO: Selecting SMTP Protocol.
INFO: SMTP with crypto.
 SERVER -> CLIENT: 220 smtp.gmail.com ESMTP bh16-20020a05600c3d1000b003a326ba4e99sm4793613wmb.34 - gsmtp

 CLIENT -> SERVER: EHLO localhost
 SERVER -> CLIENT: 250-smtp.gmail.com at your service, [xxxx.xxxx.xxxx.xxxx]
 250-SIZE 35882577
 250-8BITMIME
 250-STARTTLS
 250-ENHANCEDSTATUSCODES
 250-PIPELINING

 250-CHUNKING
 250 SMTPUTF8
 CLIENT -> SERVER: STARTTLS
 SERVER -> CLIENT: 220 2.0.0 Ready to start TLS

 CLIENT -> SERVER: EHLO localhost
 SERVER -> CLIENT: 250-smtp.gmail.com at your service, [xxxx.xxxx.xxxx.xxxx]
 250-SIZE 35882577
 250-8BITMIME
 250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH
 250-ENHANCEDSTATUSCODES
 250-PIPELINING
 250-CHUNKING
 250 SMTPUTF8
 CLIENT -> SERVER: MAIL FROM:
 SERVER -> CLIENT: 530-5.7.0 Authentication Required. Learn more at
 530 5.7.0 https://support.google.com/mail/?p=WantAuthError bh16-20020a05600c3d1000b003a326ba4e99sm4793613wmb.34 - gsmtp
 SMTP ERROR: MAIL FROM command failed: 530-5.7.0 Authentication Required. Learn more at
 530 5.7.0 https://support.google.com/mail/?p=WantAuthError bh16-20020a05600c3d1000b003a326ba4e99sm4793613wmb.34 - gsmtp
 The following From address failed: ********@gmail.com : MAIL FROM command failed,Authentication Required. Learn more at
 https://support.google.com/mail/?p=WantAuthError bh16-20020a05600c3d1000b003a326ba4e99sm4793613wmb.34 - gsmtp
 ,530,5.7.0SMTP server error: MAIL FROM command failed Detail: Authentication Required. Learn more at
 https://support.google.com/mail/?p=WantAuthError bh16-20020a05600c3d1000b003a326ba4e99sm4793613wmb.34 - gsmtp
 SMTP code: 530 Additional SMTP info: 5.7.0ERROR: PHPMailer has encountered an error.
The following From address failed: ********@gmail.com : MAIL FROM command failed,Authentication Required. Learn more at https://support.google.com/mail/?p=WantAuthError bh16-20020a05600c3d1000b003a326ba4e99sm4793613wmb.34 - gsmtp ,530,5.7.0SMTP server error: MAIL FROM command failed Detail: Authentication Required. Learn more at https://support.google.com/mail/?p=WantAuthError bh16-20020a05600c3d1000b003a326ba4e99sm4793613wmb.34 - gsmtp SMTP code: 530 Additional SMTP info: 5.7.0


Avec les nouvelles infos du fichier email.php.

<?php defined('BASEPATH') OR exit('No direct script access allowed.');

$config['useragent']        = 'PHPMailer';              // Mail engine switcher: 'CodeIgniter' or 'PHPMailer'
$config['protocol']         = 'smtp';                   // 'mail', 'sendmail', or 'smtp'
$config['mailpath']         = '/usr/sbin/sendmail';
$config['smtp_host']        = 'smtp.gmail.com';
$config['_smtp_auth']        = null;                     // Whether to use SMTP authentication, boolean TRUE/FALSE. If this option is omited or if it is NULL, then SMTP authentication is used when both $config['smtp_user'] and $config['smtp_pass'] are non-empty strings.
$config['smtp_user']        = '*******@gmail.com';
$config['smtp_pass']        = '********';
$config['smtp_port']        = 587;

$config['smtp_timeout']     = 30;                       // (in seconds)
$config['smtp_crypto']      = 'tls';                    // '' or 'tls' or 'ssl'

$config['smtp_debug']       = 0;                        // PHPMailer's SMTP debug info level: 0 = off, 1 = commands, 2 = commands and data, 3 = as 2 plus connection status, 4 = low level data output.
$config['smtp_auto_tls']    = FALSE;                    // Whether to enable TLS encryption automatically if a server supports it, even if `smtp_crypto` is not set to 'tls'.
$config['smtp_conn_options'] = array();                 // SMTP connection options, an array passed to the function stream_context_create() when connecting via SMTP.

$config['wordwrap']         = TRUE;
$config['wrapchars']        = 76;
$config['mailtype']         = 'html';                   // 'text' or 'html'
$config['charset']          = 'UTF-8';                  // 'UTF-8', 'ISO-8859-15', ...; NULL (preferable) means config_item('charset'), i.e. the character set of the site.
$config['validate']         = TRUE;
$config['priority']         = 3;                        // 1, 2, 3, 4, 5; on PHPMailer useragent NULL is a possible option, it means that X-priority header is not set at all, see https://github.com/PHPMailer/PHPMailer/issues/449
$config['crlf']             = "\n";                     // "\r\n" or "\n" or "\r"
$config['newline']          = "\n";                     // "\r\n" or "\n" or "\r"

$config['bcc_batch_mode']   = FALSE;
$config['bcc_batch_size']   = 200;
$config['encoding']         = '8bit';                   // The body encoding. For CodeIgniter: '8bit' or '7bit'. For PHPMailer: '8bit', '7bit', 'binary', 'base64', or 'quoted-printable'.

// DKIM Signing
// See https://yomotherboard.com/how-to-setup-email-server-dkim-keys/
// See http://stackoverflow.com/questions/24463425/send-mail-in-phpmailer-using-dkim-keys
// See https://github.com/PHPMailer/PHPMailer/blob/v5.2.14/test/phpmailerTest.php#L1708
$config['dkim_domain']      = '';                       // DKIM signing domain name, for exmple 'example.com'.
$config['dkim_private']     = '';                       // DKIM private key, set as a file path.
$config['dkim_private_string'] = '';                    // DKIM private key, set directly from a string.
$config['dkim_selector']    = '';                       // DKIM selector.
$config['dkim_passphrase']  = '';                       // DKIM passphrase, used if your key is encrypted.
$config['dkim_identity']    = '';                       // DKIM Identity, usually the email address used as the source of the email.

Philippe Mignon

unread,
Jul 29, 2022, 12:04:39 PM7/29/22
to jor...@googlegroups.com
Je n'avais pas fait attention. Gmail a ajouté cette année un niveau d'authentification supplémentaire qui lui est spécifique. Oauth2 il me semble. Mais cela me dépasse, j'avoue et aucune idée si ce problème est lié.
--
Philippe Mignon

Nicolas Bruneau

unread,
Oct 28, 2022, 11:21:08 AM10/28/22
to jorani
Hello,

Avez vous réussi à régler le problème des email avec outlook 365 ?

J'ai également cette erreur : 

INFO: Selecting SMTP Protocol.
INFO: SMTP with crypto.
CLIENT -> SERVER: EHLO 192.168.1.200

CLIENT -> SERVER: MAIL FROM:
SMTP ERROR: MAIL FROM command failed: 451 5.7.3 STARTTLS is required to send mail [PR3P191CA0029.EURP191.PROD.OUTLOOK.COM]
The following From address failed: *****@enclunisois.fr : MAIL FROM command failed,STARTTLS is required to send mail [PR3P191CA0029.EURP191.PROD.OUTLOOK.COM]
,451,5.7.3SMTP server error: MAIL FROM command failed Detail: STARTTLS is required to send mail [PR3P191CA0029.EURP191.PROD.OUTLOOK.COM]
SMTP code: 451 Additional SMTP info: 5.7.3ERROR: Unexpected error.
The following From address failed: ******@enclunisois.fr : MAIL FROM command failed,STARTTLS is required to send mail [PR3P191CA0029.EURP191.PROD.OUTLOOK.COM] ,451,5.7.3SMTP server error: MAIL FROM command failed Detail: STARTTLS is required to send mail [PR3P191CA0029.EURP191.PROD.OUTLOOK.COM] SMTP code: 451 Additional SMTP info: 5.7.3

Reply all
Reply to author
Forward
0 new messages