fil d'ariane

Pages personnelles de Franck GILLET > Tutoriels > Serveur de mail

Serveur de mail

Premier test

[gillet@PE1750 mail]# telnet smtp.int-evry.fr 25
Trying 157.159.x.x...
Connected to smtp.int-evry.fr.
Escape character is '^]'.
220 smtp2.int-evry.fr ESMTP Postfix
EHLO WRITER
250-smtp2.int-evry.fr
250-PIPELINING
250-SIZE 40000000
250-VRFY
250-ETRN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
MAIL FROM: gillet@percevale-messann-demo.it-sudparis.eu
250 2.1.0 Ok
RCPT TO: x.y@it-sudparis.eu
250 2.1.5 Ok
RCPT TO: z.t@laposte.net
250 2.1.5 Ok
DATA
354 End data with ...
From: MESSANN@it-sudparis.eu
To: Franck GILLET
Subject: Test
Hello!
.
250 2.0.0 Ok: queued as 461124052CD
QUIT
221 2.0.0 Bye
Connection closed by foreign host.

Installation et configuration de PostFix

[gillet@PE1750 mail]# yum remove sendmail
[gillet@PE1750 mail]# yum install postfix
[gillet@PE1750 mail]# service postfix start
[gillet@PE1750 mail]# vi /etc/postfix/main.cf
myhostname = percevale-messann-demo.it-sudparis.eu
mydomain = it-sudparis.eu
myorigin = $myhostname
default_transport = smtp
relayhost = [smtp.int-evry.fr]
mailbox_command = /usr/bin/procmail
[gillet@PE1750 mail]# postfix reload
postfix/postfix-script: refreshing the Postfix mail system
[gillet@PE1750 mail]# mail -v franck.gillet@it-sudparis.eu -s test
test5
.
Cc:
Mail Delivery Status Report will be mailed to <root>.

Configuration de la fonction PHP mail

[gillet@PE1750 PHPComponent]# vi /etc/php.ini
[mail function]
; For Win32 only.
;SMTP = smtp.int-evry.fr
;smtp_port = 25

; For Unix only.
sendmail_path = /usr/sbin/sendmail -t -i
[gillet@PE1750 PHPComponent]#service httpd restart
[gillet@PE1750 PHPComponent]# cat test_mail.php
<?php
$subject="Test postfix 1631";
$message="it works!";
$headers="";
$dest="franck.gillet@it-sudparis.eu; franck-yann.gillet@laposte.net";
if(!mail($dest,$subject,$message,$headers)) echo "Erreur fonction mail<BR>";
else echo "Hello!<BR>";
?>
[gillet@PE1750 PHPComponent]# chmod +x test_mail.php
[gillet@PE1750 PHPComponent]# php test_mail.php
Hello!<BR>
[gillet@WRITER postfix]# chkconfig --level 345 postfix on

mis à jour le 20/07/2009

Raccourcis