Create an application using Golang (using any database or in-memory storage) which sends out the Good Morning emails to all the users at 8 AM according to the different time zones of the users.
https://github.com/mavensingh/Assignment/
mysql -u username -p
create database emailsender
use emailsender
Provide the directory location of database file
source '/home/tutree/Desktop/Assignment/mysql/emailsender.sql'
Change [emailsender.service] file Configuration.
[Unit]
Description=emailsender
[Service]
Type=simple
Restart=always
RestartSec=5s
Environment=FROM="YOUR MAIL ID"
Environment=PASS="YOUR MAIL PASSWORD"
Environment=DBHOST="DATABASE HOST"
Environment=DBUSER="DATABASE USER "
Environment=DBPASS="DATABASE PASSWORD"
Environment=DBPORT="DATABASE PORT"
ExecStart=/home/tutree/Desktop/Assignment/app
[Install]
WantedBy=multi-user.target
sudo cp emailsender.service ../../../../lib/systemd/system/
OR
sudo mv emailsender.service ../../../../lib/systemd/system/
go build -o app
systemctl start emailsender
systemctl status emailsender
● emailsender.service - emailsender
Loaded: loaded (/lib/systemd/system/emailsender.service; disabled; vendor preset: enabled)
Active: active (running) since Fri 2020-05-01 13:45:50 IST; 2s ago
Main PID: 31540 (app)
Tasks: 7 (limit: 4915)
CGroup: /system.slice/emailsender.service
└─31540 /home/tutree/Desktop/Assignment/app
May 01 13:45:50 tutree-ThinkPad-X240 systemd[1]: Started emailsender.
export FROM="YOUR EMAIL ADDRESS"
export PASS="YOUR EMAIL PASSWORD"
export DBHOST="DATABASE HOST"
export DBUSER="DATABASE USER"
export DBPASS="DATABASE PASSWORD"
export DBPORT="DATABASE PORT"
source env.sh
go build -o app
./app