-
Notifications
You must be signed in to change notification settings - Fork 0
/
Send_Gmail_BOT.py
86 lines (50 loc) · 3.29 KB
/
Send_Gmail_BOT.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# Author: ClointFusion
# Project: Gmail Sending Pythonic BOT, built using ClointFusion package
# Please visit: https://lnkd.in/gh_r9YB
import time
import os
try:
import ClointFusion as cf #https://pypi.org/project/ClointFusion/
except:
os.system("pip install ClointFusion")
import ClointFusion as cf
try:
import cryptocode #ClointFusion stores your password in an encrypted way. So, you need to decrypt password at run-time.
except:
cf.os.system("pip install cryptocode")
import cryptocode
# This BOT can be run in 2 ways: Automatic and Semi-Automatic Way
cf.OFF_semi_automatic_mode()
user_choice = cf.gui_get_dropdownlist_values_from_user(msgForUser=":",dropdown_list=["Automatic","Semi Automatic"], multi_select=False)[0]
if user_choice == "Automatic":
cf.message_counter_down_timer("Launching GMail BOT in '{}' way.\n\nStored responses will be used in this execution".format(user_choice))
cf.ON_semi_automatic_mode() #Run BOT in automatic mode, without asking any GUI based questions. GUI questions would be asked first time, to store the responses
username = cf.gui_get_any_input_from_user("Email Username/Login") #GUI pop-up window, first time
password = cf.gui_get_any_input_from_user("your Email Password",True) #GUI pop-up window, first time
password = (str(cryptocode.decrypt(password, "ClointFusion")).strip()) #GUI pop-up window, first time
tomail = cf.gui_get_any_input_from_user("To Email Address") #GUI pop-up window, first time
subjectmail = cf.gui_get_any_input_from_user("Email Subject") #GUI pop-up window, first time
bodypartgmail = cf.gui_get_any_input_from_user("Email Body",multi_line=True) #GUI pop-up window, first time
elif user_choice == "Semi Automatic":
cf.message_counter_down_timer("Launching GMail BOT in '{}' way.\n\nYou can change GUI responses".format(user_choice))
username = cf.gui_get_any_input_from_user("Email Username/Login") #GUI pop-up window, Every Time, (pre-filled with last responses)
password = cf.gui_get_any_input_from_user("your Email Password",True) #GUI pop-up window, Every Time
tomail = cf.gui_get_any_input_from_user("To Email Address") #GUI pop-up window, Every Time
subjectmail = cf.gui_get_any_input_from_user("Email Subject") #GUI pop-up window, Every Time
bodypartgmail = cf.gui_get_any_input_from_user("Email Body",multi_line=True) #GUI pop-up window, Every Time
cf.launch_website_h("https://mail.google.com")
cf.browser_write_h(username,"email") #Type email address
cf.browser_mouse_click_h("next") #Type BLUE next button
cf.browser_write_h(password,"enter your password") #Type password
cf.browser_mouse_click_h("next") #Type BLUE next button
cf.browser_mouse_click_h("compose") #Click on Compose button
time.sleep(4)
cf.browser_write_h(tomail,"To") #Type directly in Recepient's To Email Address
time.sleep(2)
cf.browser_write_h(subjectmail,"Subject") #Type the subject
cf.key_press('tab') #Move from Subject field to Body part
cf.key_write_enter(bodypartgmail)
cf.browser_mouse_click_h("send") #Click BLUE Send button
cf.browser_wait_until_h("Message sent.") #Wait till email is sent
cf.browser_quit_h()
cf.message_counter_down_timer(strMsg="Mail Sent. Exiting now !", start_value=3)