-
Notifications
You must be signed in to change notification settings - Fork 0
/
verification_mailing.py
37 lines (34 loc) · 1.41 KB
/
verification_mailing.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import smtplib
import sys
from googletrans import Translator
# init the Google API translator
translator = Translator()
#1st = username
#2nd = email
#3rd = hash
#4th = language
#5th = link
#below to setup email login
server=smtplib.SMTP('smtp.gmail.com', 587)
server.starttls()
username = 'greenierealm@gmail.com'
password = 'idxlhdbfgegzyosx'
server.login(username,password)
#below to prepare customer info
link = str(sys.argv[5])
language = str(sys.argv[4])
hash_num = str(sys.argv[3])
sendto = str(sys.argv[2])
customerName = str(sys.argv[1])
#gender = 'Mr. '
#if str(sys.argv[2]) == 'Female':
# gender = 'Mrs. '
# customerName = sendto[0:sendto.index('@')].capitalize()
#below to compose the email in customized language
subject = translator.translate('GreenieRealm - Email Verification', dest=language).text
salutation = translator.translate('Hello ' + customerName + ',', dest=language).text
body = translator.translate('Thanks for signing up! You are just one step away to have telekenisis. \n\n Please click this link to activate your account: ', dest=language).text + '\n\n' + link + '/verify.php?username=' + customerName + '&hash=' + hash_num + '\n\n' + translator.translate('Best regards, ', dest=language).text + '\n\nGreenie Realm'
msg = 'From: ' +username+ '\nTo: ' + sendto + '\n'
msg = msg + 'Subject:' + subject + '\n' + salutation + '\n\n' + body
server.sendmail(username,sendto,msg.encode('utf-8'))
server.quit()