bonjour
Je suis entrain de concevoir un site web sur un serveur local Débian stretch via apache2, j’en suis à la création de mon espace membres pour cela j’ai besoin d’utiliser la fonction mail() de PHP pour la validation des comptes etc… pour ce faire j’ai installé postfix mais impossible d’envoyer un mail depuis PHP ou même en ligne de commande. J’ai lu des tonnes de tutos mais la je suis au pied du mur.
voici le fichier mail.log
Nov 18 21:09:47 server-debian postfix/pickup[27930]: 6A7CC201E8: uid=33 from=<www-data>
Nov 18 21:09:47 server-debian postfix/cleanup[6033]: 6A7CC201E8: message-id=<20181118200947.6A7CC201E8@xxxx.com>
Nov 18 21:09:47 server-debian postfix/qmgr[27929]: 6A7CC201E8: from=<www-data@xxxx.com>, size=792, nrcpt=1 (queue active)
Nov 18 21:09:47 server-debian postfix/smtp[6035]: cannot load Certification Authority data, CAfile="/etc/postfix/cacert.pem": disabling TLS support
Nov 18 21:09:47 server-debian postfix/smtp[6035]: 6A7CC201E8: to=<xxxx.xxxx@gmail.com>, relay=smtp.gmail.com[2a00:1450:400c:c06::6c]:587, delay=0.26, delays=0.09/0.01/0.13/0.02, dsn=5.7.0, status=bounced (host smtp.gmail.com[2a00:1450:400c:c06::6c] said: 530 5.7.0 Must issue a STARTTLS command first. g13-v6sm33907137wru.1 - gsmtp (in reply to MAIL FROM command))
Nov 18 21:09:47 server-debian postfix/cleanup[6033]: ADB8D201ED: message-id=<20181118200947.ADB8D201ED@xxxx.com>
Nov 18 21:09:47 server-debian postfix/qmgr[27929]: ADB8D201ED: from=<>, size=3017, nrcpt=1 (queue active)
Nov 18 21:09:47 server-debian postfix/bounce[6036]: 6A7CC201E8: sender non-delivery notification: ADB8D201ED
Nov 18 21:09:47 server-debian postfix/qmgr[27929]: 6A7CC201E8: removed
Nov 18 21:09:47 server-debian postfix/local[6037]: ADB8D201ED: to=<www-data@xxxx.com>, relay=local, delay=0.09, delays=0.04/0.01/0/0.04, dsn=2.0.0, status=sent (delivered to mailbox)
Nov 18 21:09:47 server-debian postfix/qmgr[27929]: ADB8D201ED: removed
Voici le fichier main.cf
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = xxxx.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = entrepot-de-donnees.com
mydestination = $myhostname, xxxx.com, server-debian.xxxx.com, localhost.xxxx.com, localhost
relayhost = [smtp.gmail.com]:587
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = loopback-only
inet_protocols = all
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_CAfile = /etc/postfix/cacert.pem
smtp_use_tls = yes
J’ai fait le fichier sasl_passwd avec les infos suivante
[smtp.gmail.com]:587 xxxx.xxxx@gmail.com:**************
puis la commande → postmap /etc/postfix/sasl_passwd
Voici le fichier PHP.ini
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = smtp.gmail.com
; http://php.net/smtp-port
smtp_port = 587
; For Win32 only.
; http://php.net/sendmail-from
;sendmail_from = me@example.com
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
sendmail_path = /usr/sbin/sendmail -t -i
J’ai ouvert le port 25 de ma box et iptable
ACCEPT tcp -- anywhere anywhere tcp dpt:smtp
J’ai exécuté les commandes suivante
chmod 600 /etc/postfix/sasl_passwd /etc/postfix/sasl/sasl_passwd.db
chown root:root /etc/postfix/sasl/sasl_passwd /etc/postfix/sasl/sasl_passwd.db
Merci de votre aide
Cordialement.