swaks – command line SMTP testing tool
swaks is a command line SMTP testing tool available at
http://www.jetmore.org/john/code/swaks/
On Debian/Ubuntu, you can install it with
1 |
apt install swaks |
if you just type swaks, it will ask your email, then sent a mail using MX Record to specified email address.
To send email using specific mail sevrer
1 |
swaks --to user@example.com --server test-server.example.net |
Deliver a standard test email, requiring CRAM-MD5 authentication as user [email protected]. An “X-Test” header will be added to the email body. The authentication password will be prompted for if it cannot be obtained from your .netrc file.
1 |
swaks --to user@example.com --from me@example.com --auth CRAM-MD5 --auth-user me@example.com --header-X-Test "test email" |
Here is an example command that use a remote SMTP server to sent email. I used this on a backup bash script to sent email alters after backup completed.
1 |
swaks --to serverok.in@gmail.com --from labs@serverok.in --server smtp1.serverok.in --auth-user labs@serverok.in --auth-password '7XwlzPnSmlsWsdbS' --body "This is a test message" --header 'Subject: Backup completed' |
See SMTP