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 the command
apt install swaks
if you just type swaks, it will ask for your email, then send a mail using MX Record to a specified email address.
To send email using a specific mail server
swaks --to [email protected] --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.
swaks --to [email protected] --from [email protected] --auth CRAM-MD5 --auth-user [email protected] --header-X-Test "test email"
Here is an example command that uses a remote SMTP server to send email. I used this on a backup bash script to send email alters after the backup was completed.
swaks --to [email protected] --from [email protected] --server smtp1.serverok.in --auth-user [email protected] --auth-password '7XwlzPnSmlsWsdbS' --body "This is a test message" --header 'Subject: Backup completed'
To send email from cpanel server, use
swaks --to [email protected] \
--server server46.hostonnet.com \
--port 587 \
--from [email protected] \
--auth-user [email protected] \
--auth-password 'PW_HERE' \
--body "This is a test message" \
--header 'Subject: Backup completed' \
--auth \
--tls
See SMTP
Leave a Reply