![]() | Red Hat Enterprise Linux |
Mailing - Postfix/etc/postfix/main.cfmail_owner = postfixmyhostname = Servername host machine name mydomain = domain-name your domain name myorigin = local-domain-name Domain name used by outgoing mails from this server. server users domain (or machine name). mydestination = value domains (or machine names) which receiving mails are accepted to come on server for local delivering or another server delivering by routing. This value is verified in (RCPT TO:user@domain) mynetworks = value This parameter is optional. You can use it to specify the network address from which your MTA accepts messages for relaying without further authentication. It’s a good idea to set this to your trusted network Les réseaux autorisés sont définis par le paramètre mynetworks. La valeur par défaut autorise tous les clients des sous−réseaux IP auxquels la machine est reliée. Exemples mynetworks = 127.0.0.0/8 (sécurisé : n'autorise que la machine locale) mynetworks = 127.0.0.0/8 168.100.189.2/32 Pour indiquer une liste de réseaux autorisés, écrivez les réseaux sous la forme CIDR (réseau/masque) ; par exemple : mynetworks = 168.100.189.0/28, 127.0.0.0/8 Vous pouvez également indiquer le chemin absolu d'un fichier au lieu de lister les réseaux dans le fichier main.cf. mynetworks_style = value values host (sécurisé : n'autorise que la machine locale) ne doit router que le courrier de sa machine subnet (défaut : autorise les sous−réseaux raccordés) lorsque Postfix doit router le courrier des clients SMTP connectées sur le même sous−réseau. Sur Linux, celà ne fonctionne qu'avec les interfaces mentionnées avec la commande "ifconfig". class lorsque Postfix doit router le courrier des clients SMTP de la même classe d'adresse IP (A/B/C) que celle de la machine. N'utilisez pas cette option sur une connexion par modem : celà revient à autoriser tout le réseau de votre fournisseur d'accès. NB : Si vous renseignez mynetworks, Postfix ignore le paramètre mynetworks_style. relay_domains = value domains which user are able to send mail to. This value is verified in (RCPT TO:user@domain) values $mydestination (défaut) relay_domains = (secured : don’t relay mails) $mydomain (relaie le courrier vers mon domaine et ses sous−domaines) inet_interfaces = value adresses a partir desquelles on peut se connecter au serveur postfix Values : all connexion au serveur postfix autorisee pour toute machine localhost connexion au serveur postfix réservée a la machine locale $myhostname connexion au serveur postfix réservée a la machine locale Ip address NB :vous devez arrêter et redémarrer Postfix lorsque ces paramètres (inet_interfaces ) changent. relayhost = IP This parameter define mail gateway . Use this if, for example, you want the mail server of your ISP to take care of all message delivery. home_mailbox = Maildir/ specify users mails storage for POP and IMAP Servers. This directory is placed in user home directory smtpd_sasl_auth_enable = yes : activer l’authentification smtpd_sasl_security_options = noanonymous : rejet des anonymes broken_sasl_auth_clients = yes : autoriser les MUA non stantard smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination : ce à qui on envoie les mails doivent être dans notre réseau ou sinon qu’il s’authentifie smtpd_sender_restrictions=permit_sasl_authenticated, reject : ceux qui envoi les mails doivent d’abord être authentifié Delivering methods Local delivery To another server via DNS server with MX records To another server by routing Relay to another server to deliver it for you To another server by routing Edit /etc/postfix/main.cf transport_maps = hash:/etc/postfix/transport Edit /etc/postfix/transport domain1.tld smtp :[IP or name] domain2.tld smtp :[ IP or name] NB : add these domains to $mydestination setting in /etc/postfix/main.cf [ ] are used to avoid MX record search #postmap /etc/postfix/transport I will show you on how to setup a mail forwarding run in Postfix, which is my MX record will be the email gateway and this server will forward all emails to my mail server which run under cPanel. What we really need is an MTA (mail transfer agent), application which route your email here and there until all the transaction complete and the email reach the destination. 1. In this case, I already have MX record which pointing to my cPanel server for 3 domains as below: getmail.com. MX 10 mail.getmail.com. mail A 28.90.166.173 yoursetup.net. MX 10 mail.yoursetup.net. mail A 28.90.166.173 mymouse.biz. MX 10 mail.mymouse.biz. mail A 28.90.166.173 5. Add following line at the end of line of this file. We tell Postfix to forward the email based on map that we will create in /etc/postfix/transport: transport_maps = hash:/etc/postfix/transport 6. Lets create the mail route map. Edit /etc/postfix/transport using text editor and add following line: getmail.com smtp:[28.90.166.73] yoursetup.net smtp:[28.90.166.73] mymouse.biz smtp:[28.90.166.73] 7. Any changes to this file will required us to run following command so Postfix will update the mail route: postmap /etc/postfix/transport $ telnet mail.example.com 25 Trying 10.232.45.151 Connected to localhost. Escape character is '^]'. the server greets you with its banner: 220 mail.example.com ESMTP Postfix After receiving the welcome banner, introduce yourself with the HELO command. The hostname after the HELO command should be the name of the system you're connecting from: HELO mail.oreilly.com The server replies with a success. So you may continue: 250 mail.oreilly.com Indicate who the message is from with the MAIL FROM command: MAIL FROM: Sending an e-mail directly from an SMTP Server CLItelnet localhost 25Connected to smtp.via.ecp.fr. 220 sulfura.via.ecp.fr ESMTP Postfix HELO ipnet.tg 250 sulfura.via.ecp.fr MAIL FROM: root@ipnet.tg 250 2.1.0 Ok RCPT TO: ipnet@ipnet.tg 250 2.1.5 Ok DATA 354 End data with Hello, World ! Ceci est un mail de test. . 250 2.0.0 Ok: queued as 6FEE36C37B quit 221 2.0.0 Bye |