swaks – SMTP test tool

If you deal with mail-server setup and administration, you will fall in love with swaks

I like swaks because it make testing many things easy e.g. email delivery, SMTP server, GTUBE spam test, EICAR virus test, attachment test, gmail smtp test. Also it makes finding non-verifiable emails easy from list of email addresses.

One more thing I like about swaks is automatically create subject and body content. Subject line is set to date & time which is again useful while debugging.


On Ubuntu

apt-get install swaks

On Mac

brew install swaks


Sending a test mail via localhost

swaks --to user@example.com

You can simply run swaks without any parameter as well.

When run without any parameter, it will use localhost/sendmail program as SMTP server and prompt for to email address.

Note: When you use your local machine, please make sure to check spam/junk folder on destination mail server.

Sending a test mail using any SMTP server

If your localhost cannot send mail, you can specify a reliable SMTP server using:

swaks --to user@example.com --server smtp.example.com

If smtp.example.com accepts your mail, a case of open-relay, your mail will be through. Or you will see error/reason for not sending mail in output.

Sending a test mail using Gmail’s SMTP server

swaks -t user@example.com -s smtp.gmail.com:587 -tls -a LOGIN

Above will prompt your gmail username and password. Mail will be delivered from authenticated Gmail account. You can verify this by checking your Gmail’s sent folder! 😉

Send EICAR Virus Test Email

Test a virus scanner using EICAR in an attachment.  Don’t show the message DATA part.

swaks -t user@example.com --attach --suppress-data < /path/to/eicar.txt

--attach switch can be used to specify attachment.

Send GTUBE Spam Test Email

Test a spam scanner using GTUBE in the body of an email.

swaks --to user@example.com --body /path/to/gtube/file

Test List of Fake Email Addressees

Report all the recipients in a text file that are non-verifiable:

for E in `cat /path/to/email/file`
     swaks --to $E --server test-server.example.com --quit-after RCPT --hide-all
     [ $? -ne 0 ] && echo $E

Credits: man swaks for most examples!

Discuss your project
with our experts

No obligation. Limited slots.

Contact Form Business Enquiry

"*" indicates required fields

Please attach any RFP, project specification, or document that you would like to share.
Drop files here or
Max. file size: 5 GB.
    This field is for validation purposes and should be left unchanged.