Configurations
you need smtp installed, to get it, you need (smtp and mail):
sudo apt-get install smtp mail
Setup email server configuration (edit smtp config):
/etc/ssmtp/smtp.config
into format as below:
root=your@email.com
mailhub=mail_service_provider #for example "smtp.gmail.com:465"
FromLineOverride=YES
rewriteDomain=gmail.com
AuthUser=your@email.com
AuthPass=yourpassword
#UseSTARTTLS=YES
UseTLS=YES
Sending Email in Plaintext
echo "the content of the email body" | mail -s "This is the subject" your@email.com
Troubleshooting
Just in case you run into Gmail authorization problems:1. mail: cannot send message: Process exited with a non-zero status
Probably your smtp.config has it configured incorrectly
2. ssmtp: Cannot open smtp.gmail.com:465
Check if your port number is entered correctly
3. ssmtp: Authorization failed (for Gmail, if you have 2FA activated)
You might have to follow this 2FA Gmail Solution to add an app-specified password for that particular app.
Send Email with attachment (Coming soon...)
Content coming soon... (be patient)
No comments:
Post a Comment
Hey, thank you for spending time leaving some thoughts, that would be really helpful as encouragement for us to write more quality articles! Thank you!