Install SSMTP
apt-get install ssmtpConfigure the file
nano /etc/ssmtp/ssmtp.conf
#
# Config file for sSMTP sendmail
#
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
root=thetnswe@gmail.com
# The place where the mail goes. The actual machine name is required no
# MX records are consulted. Commonly mailhosts are named mail.domain.com
mailhub=smtp.gmail.com:587
# Where will the mail seem to come from?
#rewriteDomain=thetnswe@gmail.com
# The full hostname
hostname=thetnswe@gmail.com
UseSTARTTLS=YES
AuthUser=thetnswe@gmail.com
AuthPass=password
# Are users allowed to set their own From: address?
# YES - Allow the user to specify their own From: address
# NO - Use the system generated From: address
FromLineOverride=YES
Add the user to allow to send emails
nano /etc/ssmtp/revaliases
# sSMTP aliases
#
# Format: local_account:outgoing_address:mailhub
#
# Example: root:your_login@your.domain:mailhub.your.domain[:port]
# where [:port] is an optional port number that defaults to 25.
root:thetnswe@gmail.com:smtp.gmail.com:587
localusername:thetnswe@gmail.com:smtp.gmail.com:587
Sending email
sudo ssmtp thetnswe@gmail.com
You will then type your message, hit enter and ‘ctrl+d‘
Now that you have a simple outgoing email server setup, you can do all sorts of neat things:
Creating email Form
nano /emails/email_test1.txt
sudo ssmtp thetnswe@gmail.com < /emails/email_test1.txt
Email send form might looks like this
Subject: Terminal Email Send
Email Content line 1
Email Content line 2
No comments:
Post a Comment