Goals
- Can use SMTP platform on our ubuntu server
Install SSMTP
sudo apt-get install ssmtp
Configure Account
nano /etc/ssmtp/ssmtp.conf
---
mailhub=mail.gilang.org:587
useSTARTTLS=NO
AuthUser=account@gilang.org
AuthPass=YOURMAILPASSWORD
Configure Email Client
nano email.sh
---
#!/bin/sh
SUBJECT="Test Subject"
TO="client@gmail.com"
MESSAGE="Hey There! This is a test mail"
echo $MESSAGE | sudo ssmtp -vvv $TO
--
chmod +x email.sh
nano sendemail.sh
--
#!/bin/bash
for i in {1..5}
do
/root/email.php
done
chmod +x sendemail.sh
./sendemail.sh
Use mailutils
You can use mailutils to send with command mail
apt install -y mailutils
echo $MESSAGES | mail -s "$SUBJECT" $EMAIL