How to configure the IP addresses of outgoing emails in Postfix?
This article has been created by an automatic translation software. You can view the article source here.
fr:Comment configurer les adresses IP des mails sortants dans Postfix ?
he:כיצד להגדיר תצורת כתובות ה-IP של מיילים היוצאים ב Postfix?
ro:Cum se configurează adresele IP de ieşire mesajele de poştă electronică în Postfix?
ru:Как настроить IP-адреса исходящих писем в Postfix?
pl:Jak skonfigurować adresy IP wychodzących wiadomości e-mail w Postfix?
ja:後置の発信メールの IP アドレスを構成する方法か。
ar:كيفية تكوين عناوين IP لرسائل البريد الإلكتروني الصادرة في Postfix؟
zh:如何在后缀中配置出站邮件的 IP 地址?
de:Gewusst wie: Konfigurieren von IP-Adressen der ausgehenden e-Mails in Postfix?
nl:Het configureren van de IP-adressen van uitgaande e-mails in Postfix?
it:Come configurare gli indirizzi IP dei messaggi di posta elettronica in uscita in Postfix?
pt:Como configurar os endereços IP de e-mails de saída no Postfix?
es:¿Cómo configurar las direcciones IP de los correos electrónicos salientes en Postfix?
en:How to configure the IP addresses of outbound emails in Postfix?
Symptoms
I want to change the e-mail addresses of outgoing messages for Postfix.
You may need this when the main IP address of the Server de messagerie est sur liste noire et que les e-mails sortants sont refusés par les Servers de messageries tierces.
Causes
Dans le backend Odin Plesk Panel (anciennement nommé Parallels Plesk Panel), il est codé en dur que l'adresse IP des e-mails sortants dans les fichiers de configuration Postfix (/etc/postfix/master.cf) soit identique à celle de l'IP de l'interface que Postfix écoute. La configuration se présente comme suit :
plesk-XXXXXX-XXX.XXX.XXX.XXX- unix - n n - - smtp -o smtp_bind_address=XXX.XXX.XXX.XXX -o smtp_bind_address6= -o smtp_address_preference=ipv4 -o smtp_helo_name=XXXXXX
plesk-XXXXXX-XXX.XXX.XXX.XXX- unix - n n - - smtp -o smtp_bind_address=XXX.XXX.XXX.XXX -o smtp_bind_address6= -o smtp_address_preference=ipv4 -o smtp_helo_name=XXXXXX
Résolution
Odin prévoit l'ajout d'une option accessible depuis l'interface Plesk pour modifier l'adresse IP de sortie pour un domaine donné. Cependant aucune date n'est encore annoncée pour l'arrivée de ce patch.
Solutions temporaires
Changement de l'IP pour l'ensemble du Server dédié
- Modifiez le fichier /etc/postfix/master.cf et remplacez smtp_bind_address=XXX.XXX.XXX.XXX par smtp_bind_address=YYY.YYY.YYY.YYY.
- Rechargez la configuration de Postfix.
XXX.XXX.XXX.XXX : représente votre IP actuelle
YYY.YYY.YYY.YYY : représente l'IP par laquelle vous souhaitez que vos e-mails sortent
Important : Plesk automatically reconfigures the file /etc/postfix/master.cf at each change of e-mail from the interface (creation/change of box, setting up options, etc.). Therefore, consider setting up a scheduled task to substitute your custom file. Here's the script to use for the scheduled task :
#!/bin/bash
/bin/grep 'smtp_bind_address=XXX.XXX.XXX.XXX' /etc/postfix/master.cf
if [ $? -ne 1 ]; then
/bin/sed -i 's/smtp_bind_address=XXX.XXX.XXX.XXX/smtp_bind_address=YYY.YYY.YYY.YYY/g' /etc/postfix/master.cf
/etc/init.d/postfix reload
fi
exit 0
In the case of multiple additional IP used for different domains on the same machine, it will go through another method of replacement. After manually editing the file, performing a copy :
cp /etc/postfix/master.cf /etc/postfix/master.cf.bak
The scheduled task won't modify the ongoing, but replace the master.cf with your master.cf.bak file.
#!/bin/bash
cp /etc/postfix/master.cf.bak /etc/postfix/master.cf
/etc/init.d/postfix reload
exit 0
Dans une prochaine mise à jour d'Odin Plesk Panel, les paramètres de Postfix ne devraient plus être écrasés pendant la reconfiguration de la messagerie.
A dedicated domain IP change
In case you want to change the sending IP of the mail for a single domain with its own dedicated IP, you need to set up the next scheduled task :
#!/bin/bash
/bin/grep 'plesk-exemple.com-XX.XX.XX.XX' /etc/postfix/master.cf
if [ $? -ne 1 ]; then
/bin/sed -i 's/plesk-exemple.com-XX.XX.XX.XX- unix - n n - - smtp -o smtp_bind_address=XX.XX.XX.XX/plesk-exemple.com-XX.XX.XX.XX- unix - n n - - smtp -o smtp_bind_address=YY.YY.YY.YY/g' /etc/postfix/master.cf
/etc/init.d/postfix reload
fi
exit 0
Article reference : http://kb.odin.com/fr/114491
This article seem useful to you ?
Enable comment auto-refresher