Swaks

Un article de WindowsLinux.net - Astuces pour Windows et Linux !.

Il est vrai que le test de serveurs SMTP peut s'effectuer par telnet.

Cependant Swaks permet de tester la configuration de votre serveur SMTP plus en profondeur. Swaks est le "couteau suisse" du SMTP.

Sommaire

Installation

Sous la famille Debian, le package s'installe de manière classique :

aptitude install swaks


Sinon, consultez la page de l'auteur : http://www.jetmore.org/john/code/#swaks

Exemples

Voici un exemple :

swaks --to windowslinux.net@webmail.fr --from windowslinux.net@webmail.fr
=== Trying mx.webmail.fr:25...
=== Connected to mx.webmail.fr.
<-  220 box1.creationweb.fr ESMTP Postfix (Debian/GNU)
-> EHLO your.machine.your.domain.net
<-  250-box1.creationweb.fr
<-  250-PIPELINING
<-  250-SIZE 10240000
<-  250-VRFY
<-  250-ETRN
<-  250-STARTTLS
<-  250-ENHANCEDSTATUSCODES
<-  250-8BITMIME
<-  250 DSN
-> MAIL FROM:<windowslinux.net@webmail.fr>
<-  250 2.1.0 Ok
-> RCPT TO:<windowslinux.net@webmail.fr>
<-  250 2.1.5 Ok
-> DATA
<-  354 End data with <CR><LF>.<CR><LF>
-> Date: Wed, 12 Aug 2009 18:39:29 +0200
-> To: windowslinux.net@webmail.fr
-> From: windowslinux.net@webmail.fr
-> Subject: test Wed, 12 Aug 2009 18:39:29 +0200
-> X-Mailer: swaks v20061116.0 jetmore.org/john/code/#swaks
->
-> This is a test mailing
->
-> .
<-  250 2.0.0 Ok: queued as B1FF9A8091
-> QUIT
<-  221 2.0.0 Bye
=== Connection closed with remote host.

Comme vous pouvez le constater, de nombreuses informations sont affichées, ce qui vous permet de vérifier toute erreur dans la configuration.


Il existe de nombreuses options qui peuvent êtres envoyées à SWAKS. Par exemple, vous pouvez changer la valeur du "HELO" envoyé au serveur, avec l'option "--helo". Ceci permet de détecter les restrictions au niveau SPAM.


Voici un exemple où un serveur prcis est spécifié, suivi de l'envoi d'un mail avec un nom d'hôte non valide :

swaks --server smtp.webmail.fr --helo=unqualified --to windowslinux.net@webmail.fr
=== Trying smtp.webmail.fr:25...
=== Connected to smtp.webmail.fr.
<-  220 smtp.webmail.fr ESMTP qpsmtpd 0.32 ready; send us your mail, but not your spam.
-> HELO unqualified
<** 550 Please use a qualified helo name.
*** Remote host closed connection unexpectedly.



Ou encore, un test avec une boite invalide / inexistante :

swaks --server smtp.webmail.fr --to windowslinux.net@webmail.fr
=== Trying smtp.webmail.fr:25...
=== Connected to smtp.webmail.fr.
<-  220 box1.creationweb.fr ESMTP Postfix (Debian/GNU)
-> EHLO staff.clipeo.net
<-  250-box1.creationweb.fr
<-  250-PIPELINING
<-  250-SIZE 10240000
<-  250-VRFY
<-  250-ETRN
<-  250-STARTTLS
<-  250-ENHANCEDSTATUSCODES
<-  250-8BITMIME
<-  250 DSN
-> MAIL FROM:<fgillig@staff.clipeo.net>
<-  250 2.1.0 Ok
-> RCPT TO:<windowslinux.net@webmail.fr>
<** 550 5.1.1 <windowslinux.net@webmail.fr>: Recipient address rejected: User unknown in virtual mailbox table
-> QUIT
<-  221 2.0.0 Bye
=== Connection closed with remote host.


Informations supplémentaires

N'hésitez pas à lire :

man swaks

Résultat

Un mail devrait parvenir dans votre boite mail, si votre anti-spam ne l'a pas stoppé avant.


En effet, le titre du message est le suivant :

test Wed, 12 Aug 2009 18:56:34 +0200

Avec ce contenu :

This is a test mailing

Liens

Internes

Vous pouvez lire un article sur : Postfix et dspam.

Externes

http://www.jetmore.org/john/code/#swaks