forked from sobolevn/python-code-disasters
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsend_email.py
More file actions
152 lines (130 loc) · 4.85 KB
/
Copy pathsend_email.py
File metadata and controls
152 lines (130 loc) · 4.85 KB
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# #!/usr/bin/env python
# # -*- coding: us-ascii -*-
# # Taken from a Stack-Overflow question.
# import openpyxl, pprint
# print('Opening Workbook...')
# wb = openpyxl.load_workbook('C:/Users/Bijan/Desktop/Forest Baker #1-1H/Forest Baker #1-1H Email Cheat Sheet.xlsm' , data_only = True)
# sheet = wb.get_sheet_by_name('Lateral_FlashLight')
# sheet.title
# print(sheet.title)
# sheet['e10']
# print(sheet['e10'].value)
# degree_sign= u'\N{DEGREE SIGN}'
# import openpyxl, pprint
# print('Opening Workbook...')
# print("")
# wb = openpyxl.load_workbook('C:/Users/Bijan/Desktop/Forest Baker #1-1H/Forest Baker #1-1H Email Cheat Sheet.xlsm' , data_only = True)
# sheet = wb.get_sheet_by_name('Lateral_FlashLight')
# sheet.title
# print(sheet.title)
# print("")
# sheet['e10']
# well_name = sheet['e12'].value
# well_value = sheet['f12'].value
# rig_name = sheet['e13'].value
# rig_value = sheet['f13'].value
# plan_name = sheet['e14'].value
# plan_value = sheet['f14'].value
# md_name = sheet['e17'].value
# md_value = str(sheet['f17'].value)
# inc_name = sheet['e18'].value
# inc_value = str(round(sheet['f18'].value, 2))
# azm_name = sheet['e19'].value
# azm_value = str(round(sheet['f19'].value, 2))
# tvd_name = sheet['e20'].value
# tvd_value = str(round(sheet['f20'].value, 2))
# vs_name = sheet['e21'].value
# vs_value = str(round(sheet['f21'].value, 2))
# dls_name = sheet['e22'].value
# dls_value = str(round(sheet['f22'].value, 2))
# gamma_name = sheet['e23'].value
# gamma_value = str(round(sheet['f23'].value, 2))
# temp_name = sheet['e24'].value
# temp_value = str(round(sheet['f24'].value, 2))
# slide_name = sheet['e27'].value
# slide_value = str(sheet['f27'].value)
# tf_name = sheet['e28'].value
# tf_value = str(sheet['f28'].value)
# build_name = sheet['e29'].value
# build_value = str(round(sheet['f29'].value, 2))
# motor_name = sheet['e30'].value
# motor_value = str(sheet['f30'].value)
# up_name = sheet['e33'].value
# up_value = str(sheet['f33'].value)
# left_name = sheet['e34'].value
# left_value = str(sheet['f34'].value)
# pslide_name = sheet['e35'].value
# pslide_value = str(sheet['f35'].value)
# ptf_name = sheet['e36'].value
# ptf_value = str(sheet['f36'].value)
# fmd_name = sheet['e39'].value
# fmd_value = str(sheet['f39'].value)
# finc_name = sheet['e40'].value
# finc_value = str(round(sheet['f40'].value, 2))
# fazm_name = sheet['e41'].value
# fazm_value = str(round(sheet['f41'].value, 2))
# ftvd_name = sheet['e42'].value
# ftvd_value = str(round(sheet['f42'].value, 2))
# fvs_name = sheet['e43'].value
# fvs_value = str(round(sheet['f43'].value, 2))
# fgam_name = sheet['e44'].value
# fgam_value = str(round(sheet['f44'].value, 2))
# Subject = (sheet['e10'].value)
# Comp = ( print(well_name , well_value ,),
# print(rig_name , rig_value ,),
# print(plan_name , plan_value ,),
# print (""),
# print(sheet['e16'].value ,),
# print(md_name , md_value + u'\x27' ,),
# print(inc_name , inc_value + u'\xb0' ,),
# print(azm_name , azm_value + u'\xb0' ,),
# print(tvd_name , tvd_value + u'\x27' ,),
# print(vs_name , vs_value + u'\x27' ,),
# print(dls_name , dls_value + u'\xb0' ,),
# print(gamma_name , gamma_value +' API' ,),
# print(temp_name , temp_value + u'\xb0' ,),
# print(""),
# print(sheet['e26'].value),
# print(slide_name , slide_value + u'\x27'),
# print(tf_name , tf_value + u'\xb0'),
# print(build_name , build_value + u'\xb0'),
# print(motor_name , motor_value + u'\xb0'),
# print(""),
# print(sheet['e32'].value),
# print(up_name , up_value + u'\x27'),
# print(left_name , left_value + u'\x27'),
# print(ptf_name , ptf_value + u'\xb0'),
# print(""),
# print(sheet['e38'].value),
# print(fmd_name , fmd_value + u'\x27'),
# print(finc_name , finc_value + u'\xb0'),
# print(fazm_name , fazm_value + u'\xb0'),
# print(ftvd_name , ftvd_value + u'\x27'),
# print(fvs_name , fvs_value + u'\x27'),
# print(fgam_name , fgam_value +' API'))
# import smtplib
# from email.mime.multipart import MIMEMultipart
# from email.mime.text import MIMEText
# from email.mime.base import MIMEBase
# from email import encoders
# fromaddr = "[email protected]"
# toaddr = "[email protected]"
# msg = MIMEMultipart()
# msg['From'] = fromaddr
# msg['To'] = toaddr
# msg['Subject'] = Subject
# body = Comp
# msg.attach(MIMEText(body, 'plain'))
# filename = "Capture.png"
# attachment = open("c:\\users\\Bijan\\Desktop\\Capture.PNG", "rb")
# part = MIMEBase('application', 'octet-stream')
# part.set_payload((attachment).read())
# encoders.encode_base64(part)
# part.add_header('Content-Disposition', "attachment; filename= %s" % filename)
# msg.attach(part)
# server = smtplib.SMTP('smtp.gmail.com', 587)
# server.starttls()
# server.login(fromaddr, "ragincajuns")
# text = msg.as_string()
# server.sendmail(fromaddr, toaddr, text)
# server.quit()