OVH Community, votre nouvel espace communautaire.

Problème envoit mail avec mail() php


janus57
17/01/2015, 19h43
Bonjour,

le plus simple plutôt que de se prendre la tête avec une R3 c'est d'utiliser Virtualmin ou juste Webmin sur un autre OS.

La R3 est très obscure, vu que "propriétaire" par OVH.

Cordialement, janus57

ybet
17/01/2015, 19h04
Citation Envoyé par janus57
Bonjour,
Le plus simple pour ne pas se prendre la tête : utilisé un framework PHP spécialement pour les mail.
Un mixte de sites n'est pas d'imposer un truc ou un autre pour l'envoi de mails (avec de nouveau des failles possibles).
Ce qui me gonfle le plus c'est la rr3 qui bloque un simple envoi de mails (on parle pas de listes de distributions maiss de simples formulaires vers une adresse ou d'anciens (peut-être) développements (installations d'un CMS) avec pas d'envois.

Le but n'est pas pour tous les gestionnaires de dédiés de créer des mails serveurs.
On va cloturer

janus57
16/01/2015, 19h25
Bonjour,

pour l'envois de mail en PHP faut là aussi en PHP suivre certaines règles et/ou RFC.

Le plus simple pour ne pas se prendre la tête : utilisé un framework PHP spécialement pour les mail.

Perso j'utilise un CMS qui utilise ceci : https://github.com/PHPMailer/PHPMailer

Car souvent les mails PHP qui utilise la fonction mail() de base ne suivent pas certains RFC et derrière l'anti-spam sort la hach et vous savez le résultat.

Et pour le la config du serveur soit "minimal" il faut 9/10 sur le site http://www.mail-tester.com, en dessous de 9/10 vous risquez de vous faire tager en spam et/ou blacklisté à tout moment.

Cordialement, janus57

ybet
16/01/2015, 18h58
Pour le reverse sur l'IP, host, .... c'était fait avant de trouver cette solution
(j'ai suivi tes conseils et d'autres sur ce post et te remercie ). De toute façon, c'était une solution ou changer d'hébergeur.

Effectivement, envoyer un formulaire vers une adresse user@site fonctionnait sans "bricolages" Mais c'est pas forcément le but. Simplement envoyer des données d'un formulaire de contact vers une adresse qui n'est pas du même fournisseur que l'hébergeur (le fournisseur d'accés) sans être bloqué
Et j'ai aussi lu le post how-to-ovh comme beaucoup d'autres.

Au total: ca donne à partir d'un formulaire demandant $nom, adresse mail ($mail) et message ($message)
Code:
$message_t=$date."\n Nom: "."\n nom: ".$nom."\n Adresse mail: ".$mail."/n Message/ ".$message;
                $entetes .= "From: no-reply@site_envoi < no-reply@dsite_envoi >\n";
                $entetes .= "Reply-to: no-reply@site_envoi\n"; $entete .= "X-Mailer:php/" . phpversion() . "\n";
                $entetes .= "X-Priority: 3\n";
          $entetes .='Content-Transfer-Encoding: 8bit';
$sujet="Nouveau message de ".$nom;
$webmaster=('adresse d'émission');
mail($webmaster,$sujet,$message_t,$entetes, '-fno-reply@site d'envoi);
Juste une modification de la release3 (tout fonctionnait en release2) et ... de nouveaux blocages anti-spams (ce que je comprend). Mais moi (et beaucoup) d'autres cherchent simplement à envoyer un mail d'un formulaire.

Par contre, sans modifier spf (mis par défaut par la release 3: voire les posts ci-dessus): aucune chance non plus
Patrick

bbr18
14/01/2015, 18h29
je vais me répéter mais tant que tu vas bricoler de façon anarchique sans faire la configuration complète du serveur et de Postfix, tes solutions seront toujours bancales :
- mets un reverse sur l'ip (par exemple le nom d'un domaine hébergé sur le serveur)
- configure le hostname, le fichier hosts, etc. : http://www.how-to.ovh/viewtopic.php?f=18&t=25#p102
ensuite je suis prête à parier que ça va fonctionner ^^

ybet
14/01/2015, 17h55
Finalement en bricolant http://forum.ovh.com/showthread.php?...Release3/page2

Ca donne mail('user@autre_serveurmail', 'Sujet tests', 'essais avec -f', $entete, '-fuser@nom_domaine_envoi');
Plus les modifs ci-dessus.

En 10 ans chez OVH, jamais réellement compris les paramètres serveurs pour mail: SURTOUT LES BLOCAGES, a chaque chagement de version, c'est ma même chose.

Petite remarque quand même: quand même des erreurs sur maillog puisque l'envoyeur est sécurisé en envoi smtp;

ybet
02/01/2015, 14h17
Citation Envoyé par bbr18
Code:
v=spf1 a mx a:ybet.be ip4:188.165.197.35 ip6:2001:41D0:2:8E23::/64 ~all
et essaie de rajouter
Code:
$headers .= “Return-Path: info@ybet.be \r\n”;
Spdf modifié . Ca donne http://www.mail-tester.com/web-knBnt1

mais toujours

[SPF] mail-tester.com n'autorise pas votre serveur 188.165.197.35 à utiliser ybet@mail-tester.com
Dans maillog
Code:
Jan  2 15:06:45 ns309887 postfix/qmgr[12384]: 766EC1A0D3: from=<>, size=2527, nrcpt=1 (queue active)
Jan  2 15:06:45 ns309887 postfix/trivial-rewrite[2752]: warning: do not list domain ns309887.ovh.net in BOTH mydestination and virtual_mailbox_domains
Jan  2 15:06:45 ns309887 postfix/qmgr[12384]: 7440D1A0E7: from=<>, size=2500, nrcpt=1 (queue active)
Jan  2 15:06:45 ns309887 postfix/qmgr[12384]: 67D9B1A077: from=<>, size=2839, nrcpt=1 (queue active)
Jan  2 15:06:45 ns309887 dovecot: lda(ybet): Error: user ybet: Initialization failed: mail_location not set and autodetection failed: Mail storage autodetection failed with home=/home/ybet
Jan  2 15:06:45 ns309887 dovecot: lda(ybet): Fatal: Invalid user settings. Refer to server log for more information.
Jan  2 15:06:45 ns309887 dovecot: lda(ybet): Error: user ybet: Initialization failed: mail_location not set and autodetection failed: Mail storage autodetection failed with home=/home/ybet
Jan  2 15:06:45 ns309887 dovecot: lda(ybet): Fatal: Invalid user settings. Refer to server log for more information.
Jan  2 15:06:45 ns309887 postfix/local[2756]: 766EC1A0D3: to=, orig_to=, relay=local, delay=361536, delays=361536/0.05/0/0.11, dsn=4.3.0, status=deferred (temporary failure)
Jan  2 15:06:45 ns309887 postfix/local[2757]: 7440D1A0E7: to=, orig_to=, relay=local, delay=13037, delays=13037/0.05/0/0.09, dsn=4.3.0, status=deferred (temporary failure)
Jan  2 15:06:45 ns309887 dovecot: lda(ybet): Error: user ybet: Initialization failed: mail_location not set and autodetection failed: Mail storage autodetection failed with home=/home/ybet
Jan  2 15:06:45 ns309887 dovecot: lda(ybet): Fatal: Invalid user settings. Refer to server log for more information.
Jan  2 15:06:45 ns309887 postfix/local[2757]: 67D9B1A077: to=, orig_to=, relay=local, delay=1136, delays=1136/0.14/0/0.05, dsn=4.3.0, status=deferred (temporary failure)
Et en remplacant par mon adresse IP

Code:
Jan  2 15:13:19 ns309887 postfix/pickup[1881]: 58D081A073: uid=514 from=
Jan  2 15:13:19 ns309887 postfix/cleanup[3291]: 58D081A073: message-id=<20150102141319.58D081A073@ns309887.ovh.net>
Jan  2 15:13:19 ns309887 opendkim[10691]: 58D081A073: DKIM-Signature field added (s=default, d=ybet.be)
Jan  2 15:13:19 ns309887 postfix/qmgr[12384]: 58D081A073: from=, size=489, nrcpt=1 (queue active)
Jan  2 15:13:20 ns309887 postfix/smtp[3301]: 58D081A073: to=, relay=mx11.skynet.be[195.238.20.25]:25, delay=0.87, delays=0.16/0.02/0.69/0, dsn=5.0.0, status=bounced (host mx11.skynet.be[195.238.20.25] said: 501 #5.1.3 Partial domain not allowed: '' (in reply to MAIL FROM command))
Jan  2 15:13:20 ns309887 postfix/cleanup[3291]: 400521A081: message-id=<20150102141320.400521A081@ns309887.ovh.net>
Jan  2 15:13:20 ns309887 postfix/qmgr[12384]: 400521A081: from=<>, size=2720, nrcpt=1 (queue active)
Jan  2 15:13:20 ns309887 postfix/bounce[3302]: 58D081A073: sender non-delivery notification: 400521A081
Jan  2 15:13:20 ns309887 postfix/trivial-rewrite[3292]: warning: do not list domain ns309887.ovh.net in BOTH mydestination and virtual_mailbox_domains
Jan  2 15:13:20 ns309887 postfix/qmgr[12384]: 58D081A073: removed
Jan  2 15:13:20 ns309887 dovecot: lda(ybet): Error: user ybet: Initialization failed: mail_location not set and autodetection failed: Mail storage autodetection failed with home=/home/ybet
Jan  2 15:13:20 ns309887 dovecot: lda(ybet): Fatal: Invalid user settings. Refer to server log for more information.
Jan  2 15:13:20 ns309887 postfix/local[3177]: 400521A081: to=, orig_to=, relay=local, delay=0.08, delays=0.03/0/0/0.05, dsn=4.3.0, status=deferred (temporary failure)
Remarque que dans les deux cas, l'origine est orig_to= et pas une adresse mail valide.

bbr18
31/12/2014, 16h40
le spf coince toujours
Code:
v=spf1 a ip4:188.165.197.35 ip6:2001:41D0:2:8E23::/64 mx ~all
essaie avec celui là, et incrémente le serial dans ta zone DNS
Code:
v=spf1 a mx a:ybet.be ip4:188.165.197.35 ip6:2001:41D0:2:8E23::/64 ~all
et essaie de rajouter
Code:
$headers .= “Return-Path: info@ybet.be \r\n”;

ybet
31/12/2014, 14h10
Je viens d'envoyer un mail en php à mail-tester
Code:
                            $headers ='From: info@ybet.be'."\n";
                            $headers .='Reply-To: webmaster@ybet.be'."\n";
                            $headers .='Content-Type: text/plain; charset="iso-8859-1"'."\n";
                            $headers .='Content-Transfer-Encoding: 8bit';
                            mail('web-knBnt1@mail-tester.com', 'Sujet',
                            'Message contenu de l email', $headers);?>
Un peu mieux 6.4

http://www.mail-tester.com/web-knBnt1

Pour le serveur, une dizaine de sites sont installés mais aucun ne gère d'adresses mail propres. Seuls des formulaires permettent d'envoyer des informations à des utilisateurs: pour quasiment tous: ce sont des formulaires de demandes de renseignements.

bbr18
31/12/2014, 13h09
Toujours le nom de serveur au lieu du domaine (materiel-informatique.be)
as-tu pensé à incrémenter le serial ? De toutes façons niveau dns ce n'est pas instantané.

Arcan_-
31/12/2014, 12h44
Bonjour,

Merci bbr18, je ne connaissais pas cet outil.

Comprend pas pourquoi on retrouve de nouveau le serveur et pas le domaine. ybet.be ... à part localHost en php.ini?
Quand tu envois un mail en ligne de commande, le nom d'utilisateur est utilisé pour remplir le from (à moins d'ajouter le header avec -a "from: email@domain.tld").

Postfix utilise un Return-path user@serveur. D'où l'adresse ybet(a)ns309887.ovh.net pour le bounce.
Et comme le domaine ns309887.ovh.net n'est sans doute pas géré par dovecot, tu as l'erreur :
Dec 31 11:23:33 ns309887 dovecot: lda(ybet): Error: user ybet: Initialization failed: mail_location not set and autodetection failed: Mail storage autodetection failed with home=/home/ybet
Dec 31 11:23:33 ns309887 dovecot: lda(ybet): Fatal: Invalid user settings. Refer to server log for more information.
Qui veut dire que dovecot ne peut pas délivrer les mail à l'user ybet.
Mais c'est un autre problème (de réception celui là).

Peux tu refaire le même test vers test-mailer avec le header fixé (via php ou avec le -a par exemple) ?

As tu plusieurs domaines à héberger ?
Combien de boites mail à la louche ?

ybet
31/12/2014, 12h28
Utilisé la procédure des pistes pour configurer postfix ... idem

http://www.mail-tester.com/web-XtgXPz

Toujours le nom de serveur au lieu du domaine (materiel-informatique.be)

Ce qui est débi*le, c'est je reçois tous les messages de fail2ban sans problème. Ce qui me paraît le plus bizarre c'est que l'installation du serveur n'est pas modifié depuis sa réinstallation (qui n'a rien changé même si c'était pas le but). Alors pourquoi d'autres n'ont pas le problème?

J'ai aussi demandé pour barracuda

Merci pour votre aide.

bbr18
31/12/2014, 11h10
en ouvrant les commentaires sur http://www.mail-tester.com/web-knBnt0 tu as les pistes pour améliorer, parce que là avec 4.9/10 c'est normal que tes mails n'arrivent pas.
tu devrais aussi mettre un reverse sur ton ip (manager serveur)
ton spf devrait comporter le nom du domaine
Code:
v=spf1 a mx a:ybet.be ip4:188.165.197.35 ~all
des pistes pour configurer postfix
faire déblacklister chez barracuda

ybet
31/12/2014, 10h48
Voici la réponse:

Source
Code:
Received: by vps80627.ovh.net (Postfix, from userid 500)	id C73B2124150C;
	Wed, 31 Dec 2014 11:43:09 +0100 (CET)
X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail-tester.com
X-Spam-Level: *
X-Spam-Status: No/1.1/5.0
X-Spam-Test-Scores: RCVD_IN_BRBL_LASTEXT=1.644,RP_MATCHES_RCVD=-0.55
X-Spam-Last-External-IP: 188.165.197.35
X-Spam-Last-External-HELO: ns309887.ovh.net
X-Spam-Last-External-rDNS: ns309887.ovh.net
X-Spam-Date-of-Scan: Wed, 31 Dec 2014 11:43:09 +0100
X-Spam-Report: * -0.6 RP_MATCHES_RCVD Envelope sender domain matches
 handover relay domain	*  1.6 RCVD_IN_BRBL_LASTEXT RBL: No description
 available.	*      [188.165.197.35 listed in bb.barracudacentral.org]
Received: from ns309887.ovh.net (ns309887.ovh.net [188.165.197.35])
	by vps80627.ovh.net (Postfix) with ESMTP id 2090112410A3
	for ; Wed, 31 Dec 2014 11:43:05 +0100 (CET)
Received: by ns309887.ovh.net (Postfix, from userid 0)	id 244FC1A0DA;
	Wed, 31 Dec 2014 11:43:04 +0100 (CET)
Date: Wed, 31 Dec 2014 11:43:04 +0100
To: web-knBnt0@mail-tester.com
Subject: tester mon envoi de mail
User-Agent: Heirloom mailx 12.4 7/29/08
MIME-Version: 1.0
Message-Id: <20141231104304.244FC1A0DA@ns309887.ovh.net>
From: root 
Return-Path: postmaster@ns309887.ovh.net
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

salut
Pour l'authentification
Code:
[SPF] ns309887.ovh.net n'autorise pas votre serveur 188.165.197.35 à utiliser postmaster@ns309887.ovh.net

-1 

[Sender ID] ns309887.ovh.net n'autorise pas votre serveur 188.165.197.35 à utiliser postmaster@ns309887.ovh.net

bbr18
31/12/2014, 10h41
Tape ceci en ssh pour tester ton envoi de mail
Code:
echo "salut " | mail -s "tester mon envoi de mail" web-knBnt0@mail-tester.com
puis tu vas voir le résultat ici : http://www.mail-tester.com/web-knBnt0
ça te donnera les choses à améliorer (avec les explications)
Tu peux aussi envoyer avec la fonction mail() pour comparer

(ps : utilise les balises code pour éviter les posts de 10 km de long, en mode avance c'est l’icône # ), merci

ybet
31/12/2014, 10h26
Pour la partie mail dans php.ini

[mail function]
; For Win32 only.
; http://www.php.net/manual/en/mail.co...n.php#ini.smtp
SMTP = localhost
; http://www.php.net/manual/en/mail.co...#ini.smtp-port
smtp_port = 25

; For Win32 only.
; http://www.php.net/manual/en/mail.co....sendmail-from
;sendmail_from = me@example.com

; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
; http://www.php.net/manual/en/mail.co....sendmail-path
sendmail_path = /usr/sbin/sendmail -t -i

; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =

; Add X-PHP-Originaiting-Script: that will include uid of the script followed by the filename
mail.add_x_header = On

; Log all mail() calls including the full path of the script, line #, to address and headers
;mail.log =

Effectivement, il y a local host mais c'est valable pour tous les domaines sur le serveur (ca ne fonctionne de toute façon à partir d'aucun site).

J'ai essayé autre chose:
$headers ='From: info@ybet.be'."\n";
$headers .='Reply-To: webmaster@ybet.be'."\n";
$headers .='Content-Type: text/plain; charset="iso-8859-1"'."\n";
$headers .='Content-Transfer-Encoding: 8bit';
mail('patrick.lejeune@skynet.be', 'Sujet',
'Message contenu de l email', $headers);?>

Et en maillog, ca donne
Dec 31 11:23:32 ns309887 postfix/pickup[22487]: DA8ED1A0DA: uid=514 from=
Dec 31 11:23:32 ns309887 postfix/cleanup[31691]: DA8ED1A0DA: message-id=<20141231102332.DA8ED1A0DA@ns309887.ovh.net>
Dec 31 11:23:32 ns309887 opendkim[18134]: DA8ED1A0DA: DKIM-Signature field added (s=default, d=ybet.be)
Dec 31 11:23:32 ns309887 postfix/qmgr[32127]: DA8ED1A0DA: from=, size=500, nrcpt=1 (queue active)
Dec 31 11:23:33 ns309887 postfix/smtp[31703]: DA8ED1A0DA: to=, relay=mx11.skynet.be[195.238.20.25]:25, delay=0.9, delays=0.18/0.02/0.69/0, dsn=5.0.0, status=bounced (host mx11.skynet.be[195.238.20.25] said: 501 #5.1.3 Partial domain not allowed: '' (in reply to MAIL FROM command))
Dec 31 11:23:33 ns309887 postfix/cleanup[31691]: C7F1D1A0DC: message-id=<20141231102333.C7F1D1A0DC@ns309887.ovh.net>
Dec 31 11:23:33 ns309887 postfix/qmgr[32127]: C7F1D1A0DC: from=<>, size=2753, nrcpt=1 (queue active)
Dec 31 11:23:33 ns309887 postfix/bounce[31704]: DA8ED1A0DA: sender non-delivery notification: C7F1D1A0DC
Dec 31 11:23:33 ns309887 postfix/trivial-rewrite[31692]: warning: do not list domain ns309887.ovh.net in BOTH mydestination and virtual_mailbox_domains
Dec 31 11:23:33 ns309887 postfix/qmgr[32127]: DA8ED1A0DA: removed
Dec 31 11:23:33 ns309887 dovecot: lda(ybet): Error: user ybet: Initialization failed: mail_location not set and autodetection failed: Mail storage autodetection failed with home=/home/ybet
Dec 31 11:23:33 ns309887 dovecot: lda(ybet): Fatal: Invalid user settings. Refer to server log for more information.
Dec 31 11:23:33 ns309887 postfix/local[31705]: C7F1D1A0DC: to=, orig_to=, relay=local, delay=0.13, delays=0.04/0.02/0/0.07, dsn=4.3.0, status=deferred (temporary failure)

Comprend pas pourquoi on retrouve de nouveau le serveur et pas le domaine. ybet.be ... à part localHost en php.ini?

Arcan_-
30/12/2014, 20h22
Re-bonjour,

Toujours le même problème avec le milter injoignable sur le port 8891 ?
Si oui, peux tu nous donner le resultat de # postconf, et # netstat -tanpu|grep :8891 ?

Le problème n'est pas l'adresse du destinataire. D'ailleurs Skynet.be a écrit un message d'erreur.
Ton adresse d'expéditeur par contre n'est pas acceptable.
Il y a : "" sans aucun nom de domaine.
C'est bien ce que j'ai dit.
Deux pistes à première vue pour ce problème :
  • Le myorigin=$mydomain, ou mydomain=localdomain (donc pas un domaine complet avec domaine.tld). Es tu propriétaire d'un domaine que tu peux utiliser pour remplacer localdomain ?
  • L'appel de sendmail via php qui ne prend pas en compte les headers du mail (sont ils bien fixés dans tes scripts ?). Voir le php.ini et les sendmail_path.


Bonne soirée,

fritz2cat
30/12/2014, 20h07
Le problème n'est pas l'adresse du destinataire. D'ailleurs Skynet.be a écrit un message d'erreur.
Ton adresse d'expéditeur par contre n'est pas acceptable.
Il y a : "" sans aucun nom de domaine.
Tout comme Skynet, je refuse d'accepter des mails entrants avec une telle adresse sans nom de domaine.

ybet
30/12/2014, 18h37
ybet-@-Skynet.be est mon adresse mail (suffit de supprimer les -

C'est une installation par défaut (viens de réinstaller le serveur et même problème).

Pour main.cfg
"# Global Postfix configuration file. This file lists only a subset
# of all parameters. For the syntax, and for a complete parameter
# list, see the postconf(5) manual page (command: "man 5 postconf").
#
# For common configuration examples, see BASIC_CONFIGURATION_README
# and STANDARD_CONFIGURATION_README. To find these documents, use
# the command "postconf html_directory readme_directory", or go to
# http://www.postfix.org/.
#
# For best results, change no more than 2-3 parameters at a time,
# and test if Postfix still works after every change.

# SOFT BOUNCE
#
# The soft_bounce parameter provides a limited safety net for
# testing. When soft_bounce is enabled, mail will remain queued that
# would otherwise bounce. This parameter disables locally-generated
# bounces, and prevents the SMTP server from rejecting mail permanently
# (by changing 5xx replies into 4xx replies). However, soft_bounce
# is no cure for address rewriting mistakes or mail routing mistakes.
#
#soft_bounce = no

# LOCAL PATHNAME INFORMATION
#
# The queue_directory specifies the location of the Postfix queue.
# This is also the root directory of Postfix daemons that run chrooted.
# See the files in examples/chroot-setup for setting up Postfix chroot
# environments on different UNIX systems.
#
queue_directory = /var/spool/postfix

# The command_directory parameter specifies the location of all
# postXXX commands.
#
command_directory = /usr/sbin

# The daemon_directory parameter specifies the location of all Postfix
# daemon programs (i.e. programs listed in the master.cf file). This
# directory must be owned by root.
#
daemon_directory = /usr/libexec/postfix

# The data_directory parameter specifies the location of Postfix-writable
# data files (caches, random numbers). This directory must be owned
# by the mail_owner account (see below).
#
data_directory = /var/lib/postfix

# QUEUE AND PROCESS OWNERSHIP
#
# The mail_owner parameter specifies the owner of the Postfix queue
# and of most Postfix daemon processes. Specify the name of a user
# account THAT DOES NOT SHARE ITS USER OR GROUP ID WITH OTHER ACCOUNTS
# AND THAT OWNS NO OTHER FILES OR PROCESSES ON THE SYSTEM. In
# particular, don't specify nobody or daemon. PLEASE USE A DEDICATED
# USER.
#
mail_owner = postfix

# The default_privs parameter specifies the default rights used by
# the local delivery agent for delivery to external file or command.
# These rights are used in the absence of a recipient user context.
# DO NOT SPECIFY A PRIVILEGED USER OR THE POSTFIX OWNER.
#
#default_privs = nobody

# INTERNET HOST AND DOMAIN NAMES
#
# The myhostname parameter specifies the internet hostname of this
# mail system. The default is to use the fully-qualified domain name
# from gethostname(). $myhostname is used as a default value for many
# other configuration parameters.
#
myhostname = ns309887.ovh.net

# The mydomain parameter specifies the local internet domain name.
# The default is to use $myhostname minus the first component.
# $mydomain is used as a default value for many other configuration
# parameters.
#
mydomain = localdomain

# SENDING MAIL
#
# The myorigin parameter specifies the domain that locally-posted
# mail appears to come from. The default is to append $myhostname,
# which is fine for small sites. If you run a domain with multiple
# machines, you should (1) change this to $mydomain and (2) set up
# a domain-wide alias database that aliases each user to
# user@that.users.mailhost.
#
# For the sake of consistency between sender and recipient addresses,
# myorigin also specifies the default domain name that is appended
# to recipient addresses that have no @domain part.
#
#myorigin = $myhostname
myorigin = $mydomain

# RECEIVING MAIL

# The inet_interfaces parameter specifies the network interface
# addresses that this mail system receives mail on. By default,
# the software claims all active interfaces on the machine. The
# parameter also controls delivery of mail to user@[ip.address].
#
# See also the proxy_interfaces parameter, for network addresses that
# are forwarded to us via a proxy or network address translator.
#
# Note: you need to stop/start Postfix when this parameter changes.
#
inet_interfaces = all
#inet_interfaces = $myhostname
#inet_interfaces = $myhostname, localhost
#inet_interfaces = localhost

# Enable IPv4, and IPv6 if supported
inet_protocols = all

# The proxy_interfaces parameter specifies the network interface
# addresses that this mail system receives mail on by way of a
# proxy or network address translation unit. This setting extends
# the address list specified with the inet_interfaces parameter.
#
# You must specify your proxy/NAT addresses when your system is a
# backup MX host for other domains, otherwise mail delivery loops
# will happen when the primary MX host is down.
#
#proxy_interfaces =
#proxy_interfaces = 1.2.3.4

# The mydestination parameter specifies the list of domains that this
# machine considers itself the final destination for.
#
# These domains are routed to the delivery agent specified with the
# local_transport parameter setting. By default, that is the UNIX
# compatible delivery agent that lookups all recipients in /etc/passwd
# and /etc/aliases or their equivalent.
#
# The default is $myhostname + localhost.$mydomain. On a mail domain
# gateway, you should also include $mydomain.
#
# Do not specify the names of virtual domains - those domains are
# specified elsewhere (see VIRTUAL_README).
#
# Do not specify the names of domains that this machine is backup MX
# host for. Specify those names via the relay_domains settings for
# the SMTP server, or use permit_mx_backup if you are lazy (see
# STANDARD_CONFIGURATION_README).
#
# The local machine is always the final destination for mail addressed
# to user@[the.net.work.address] of an interface that the mail system
# receives mail on (see the inet_interfaces parameter).
#
# Specify a list of host or domain names, /file/name or type:table
# patterns, separated by commas and/or whitespace. A /file/name
# pattern is replaced by its contents; a type:table is matched when
# a name matches a lookup key (the right-hand side is ignored).
# Continue long lines by starting the next line with whitespace.
#
# See also below, section "REJECTING MAIL FOR UNKNOWN LOCAL USERS".
#
mydestination = localhost.$mydomain, localhost, localhost.localdomain
#mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
#mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain,
# mail.$mydomain, www.$mydomain, ftp.$mydomain

# REJECTING MAIL FOR UNKNOWN LOCAL USERS
#
# The local_recipient_maps parameter specifies optional lookup tables
# with all names or addresses of users that are local with respect
# to $mydestination, $inet_interfaces or $proxy_interfaces.
#
# If this parameter is defined, then the SMTP server will reject
# mail for unknown local users. This parameter is defined by default.
#
# To turn off local recipient checking in the SMTP server, specify
# local_recipient_maps = (i.e. empty).
#
# The default setting assumes that you use the default Postfix local
# delivery agent for local delivery. You need to update the
# local_recipient_maps setting if:
#
# - You define $mydestination domain recipients in files other than
# /etc/passwd, /etc/aliases, or the $virtual_alias_maps files.
# For example, you define $mydestination domain recipients in
# the $virtual_mailbox_maps files.
#
# - You redefine the local delivery agent in master.cf.
#
# - You redefine the "local_transport" setting in main.cf.
#
# - You use the "luser_relay", "mailbox_transport", or "fallback_transport"
# feature of the Postfix local delivery agent (see local(8)).
#
# Details are described in the LOCAL_RECIPIENT_README file.
#
# Beware: if the Postfix SMTP server runs chrooted, you probably have
# to access the passwd file via the proxymap service, in order to
# overcome chroot restrictions. The alternative, having a copy of
# the system passwd file in the chroot jail is just not practical.
#
# The right-hand side of the lookup tables is conveniently ignored.
# In the left-hand side, specify a bare username, an @domain.tld
# wild-card, or specify a user@domain.tld address.
#
#local_recipient_maps = unixasswd.byname $alias_maps
#local_recipient_maps = proxy:unixasswd.byname $alias_maps
local_recipient_maps = unixasswd.byname

# The unknown_local_recipient_reject_code specifies the SMTP server
# response code when a recipient domain matches $mydestination or
# ${proxy,inet}_interfaces, while $local_recipient_maps is non-empty
# and the recipient address or address local-part is not found.
#
# The default setting is 550 (reject mail) but it is safer to start
# with 450 (try again later) until you are certain that your
# local_recipient_maps settings are OK.
#
unknown_local_recipient_reject_code = 550

# TRUST AND RELAY CONTROL

# The mynetworks parameter specifies the list of "trusted" SMTP
# clients that have more privileges than "strangers".
"
Pour master.cf
"
#
# Postfix master process configuration file. For details on the format
# of the file, see the master(5) manual page (command: "man 5 master").
#
# Do not forget to execute "postfix reload" after editing this file.
#
# ================================================== ========================
# service type private unpriv chroot wakeup maxproc command + args
# (yes) (yes) (yes) (never) (100)
# ================================================== ========================
smtp inet n - n - - smtpd
587 inet n - n - - smtpd
-o smtpd_tls_security_level=encrypt
-o smtpd_tls_auth_only=yes
-o smtpd_tls_cert_file=/etc/pki/tls/certs/localhost.crt
-o smtpd_tls_key_file=/etc/pki/tls/private/localhost.key
-o smtpd_sasl_type=dovecot
-o smtpd_sasl_auth_enable=yes
-o smtpd_sasl_path=/var/spool/postfix/private/auth
-o smtpd_recipient_restrictions=$external_submission_ restrictions
-o receive_override_options=no_address_mappings
pickup fifo n - n 60 1 pickup
cleanup unix n - n - 0 cleanup
qmgr fifo n - n 300 1 qmgr
tlsmgr unix - - n 1000? 1 tlsmgr
rewrite unix - - n - - trivial-rewrite
-o append_at_myorigin=no
bounce unix - - n - 0 bounce
defer unix - - n - 0 bounce
trace unix - - n - 0 bounce
verify unix - - n - 1 verify
flush unix n - n 1000? 0 flush
proxymap unix - - n - - proxymap
proxywrite unix - - n - 1 proxymap
smtp unix - - n - - smtp
relay unix - - n - - smtp
-o smtp_fallback_relay=
showq unix n - n - - showq
error unix - - n - - error
retry unix - - n - - error
discard unix - - n - - discard
local unix - n n - - local
virtual unix - n n - - virtual
lmtp unix - - n - - lmtp
anvil unix - - n - 1 anvil
scache unix - - n - 1 scache
dovecot unix - n n - - pipe
flags=DRhu user=mailboxes:mailboxes argv=/usr/libexec/dovecot/deliver -f ${sender} -d ${user}@${nexthop}
amavisfeed unix - - n - 2 smtp
-o smtp_data_done_timeout=1200
-o smtp_send_xforward_command=yes
-o disable_dns_lookup=yes
-o max_use=20
127.0.0.1:10025 inet n - n - - smtpd
-o content_filter=
-o smtpd_delay_reject=no
-o smtpd_client_restrictions=permit_mynetworks,reject
-o smtpd_helo_restrictions=
-o smtpd_sender_restrictions=
-o smtpd_recipient_restrictions=permit_mynetworks,rej ect
-o receive_override_options=no_address_mappings
-o smtpd_data_restrictions=reject_unauth_pipelining
-o smtpd_end_of_data_restrictions=
-o smtpd_restriction_classes=
-o mynetworks=127.0.0.0/8
-o smtpd_error_sleep_time=0
-o smtpd_soft_error_limit=1001
-o smtpd_hard_error_limit=1000
-o smtpd_client_connection_count_limit=0
-o smtpd_client_connection_rate_limit=0
-o receive_override_options=no_header_body_checks,no_ unknown_recipient_checks,no_milters,no_address_map pings
-o local_header_rewrite_clients=
vacation unix - n n - - pipe
flags=Rq user=vacation argv=/var/spool/vacation/vacation.pl -f ${sender} -- ${recipient}
"
Voilà déjà pour les deux premiers. Finalement avec la release 3: je cherche quasiment tous les emplacements. A chaque modif de serveur c'est la même chose depuis 10 ans: vais les trouver en cherchant.
Merci pour t'intéresser au problème. Pour l'application c'est un simple envoi par la commande mail(), mais ca bloque aussi d'autres applications tierces.

Arcan_-
30/12/2014, 17h19
Bonjour,

Dec 26 17:42:22 ns309887 postfix/cleanup[13919]: warning: connect to Milter service inet:localhost:8891: Connection refused
Postfix utilise des "milters" pour assurer ses fonctionnalités de filtrage (anti spam, antivirus, dkim...). Je ne sais pas lequel utilise le port 8891.

Dec 26 17:42:22 ns309887 postfix/qmgr[19041]: 3EB9D11CF65: from=, size=388, nrcpt=1 (queue active)
Dec 26 17:42:23 ns309887 postfix/smtp[13928]: 3EB9D11CF65: to=-@-skynet.be>, relay=mx11.skynet.be[195.238.20.25]:25, delay=0.99, delays=0.13/0.02/0.84/0, dsn=5.0.0, status=bounced (host mx11.skynet.be[195.238.20.25] said: 501 #5.1.3 Partial domain not allowed: '' (in reply to MAIL FROM command))
L'expéditeur est "ybet". Ce n'est pas une @mail valide.
C'est sans doute la clause "sendmail_path" dans ton php.ini, ou postfix qui réécrit le header from.

Peut-on voir les configuration de postfix (main.cf et master.cf), de php, et de docevot ?

Bonnes fêtes

ybet
26/12/2014, 17h05
Ca fait deux jours que je tourne en rond: envoi d'un mail avec la fonction mail() en PHP.
OVH dédié release 3
Différents tests effectués:
1. la fonction mail renvoie TRUE (mail envoyé).
2. idem en ajoutant (ou supprimant) en header From et Reply

Dans maillog: différents messages d'erreur:

Dec 26 17:42:22 ns309887 postfix/pickup[11510]: 3EB9D11CF65: uid=502 from=
Dec 26 17:42:22 ns309887 postfix/cleanup[13919]: warning: connect to Milter service inet:localhost:8891: Connection refused

// rien trouvé sur Internet

Dec 26 17:42:22 ns309887 postfix/cleanup[13919]: 3EB9D11CF65: message-id=<20141226164222.3EB9D11CF65@ns309887.ovh.net>
Dec 26 17:42:22 ns309887 postfix/qmgr[19041]: 3EB9D11CF65: from=, size=388, nrcpt=1 (queue active)
Dec 26 17:42:23 ns309887 postfix/smtp[13928]: 3EB9D11CF65: to=-@-skynet.be>, relay=mx11.skynet.be[195.238.20.25]:25, delay=0.99, delays=0.13/0.02/0.84/0, dsn=5.0.0, status=bounced (host mx11.skynet.be[195.238.20.25] said: 501 #5.1.3 Partial domain not allowed: '' (in reply to MAIL FROM command))

Et deuxième erreur incompréhensible

Dec 26 17:42:23 ns309887 postfix/cleanup[13919]: 3C1E611CFC3: message-id=<20141226164223.3C1E611CFC3@ns309887.ovh.net>
Dec 26 17:42:23 ns309887 postfix/qmgr[19041]: 3C1E611CFC3: from=<>, size=2204, nrcpt=1 (queue active)
Dec 26 17:42:23 ns309887 postfix/bounce[13929]: 3EB9D11CF65: sender non-delivery notification: 3C1E611CFC3
Dec 26 17:42:23 ns309887 postfix/trivial-rewrite[13920]: warning: do not list domain ns309887.ovh.net in BOTH mydestination and virtual_mailbox_domains
Troisième erreur ???

Dec 26 17:42:23 ns309887 postfix/qmgr[19041]: 3EB9D11CF65: removed
Je suppose qu'avec les erreurs, le message est supprimé.

Dec 26 17:42:23 ns309887 postfix/local[13930]: 3C1E611CFC3: to=, orig_to=, relay=local, delay=0.1, delays=0.03/0.02/0/0.05, dsn=4.3.0, status=deferred (temporary failure. Command output: doveconf: Fatal: Error in configuration file /etc/dovecot/dovecot.conf line 77: Expecting '=' )

Probablement la ligne ajoutée suite à un post lu sur Internet : mail_location = mbox:~/mail:INBOX=/var/mail/%u

Apparement, les erreurs ne viennent pas de la fonction mail() en elle-même mais soit de dovecot qui ne comprend pas où mettre le mail en attente, éventuellement de postfix ...

A force de lire tout et n'importe quoi sur Internet, je commence à douter de tout. A chaque changement de version sur OVH, c'est le même bord*el pour les mails (mais là je sèche)

-@-skynet.be>, est l'adresse d'envoi
ybet est le compte utilisateur


Idem, pas d'envoi en passant par un dévelloppement d'autres d'un forum présent sur un des sites.
Merci d'avance.