Skip to content

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.

Notifications You must be signed in to change notification settings

Coder-Kuldeep-Singh/Assignment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EmailSender

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.

Follow The Guidelines To setup the EmailSender Software

Installation

Clone the Repository

https://github.com/mavensingh/Assignment/

Setup The database

mysql -u username -p
create database emailsender
use emailsender

Provide the directory location of database file

source '/home/tutree/Desktop/Assignment/mysql/emailsender.sql'

Configure the Systemd File

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

Open Terminal and Run the command

sudo cp emailsender.service ../../../../lib/systemd/system/

OR

sudo mv emailsender.service ../../../../lib/systemd/system/

Open New Tab and Run the command

go build -o app

Then Run this Command to start emailsender as Service

systemctl start emailsender

Check The status Service Running or not

systemctl status emailsender

Output

● 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.

Alternative

Modified the env.sh file

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 the env.sh file

source env.sh

Build the Software

go build -o app

Run the Binary

./app

Note: Run [systemctl status emailsender] to check Service Running in background or not

About

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.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published