Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
weather_report
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vipul.v
weather_report
Commits
e1bc3832
Commit
e1bc3832
authored
Mar 20, 2023
by
vipul.v
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
first
parent
9ae5b679
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
12 deletions
+47
-12
.idea/sonarlint/issuestore/index.pb
.idea/sonarlint/issuestore/index.pb
+13
-0
.idea/sonarlint/securityhotspotstore/index.pb
.idea/sonarlint/securityhotspotstore/index.pb
+13
-0
Weather Report_daily.xlsx
Weather Report_daily.xlsx
+0
-0
script/core/handler/send_email.py
script/core/handler/send_email.py
+21
-12
No files found.
.idea/sonarlint/issuestore/index.pb
View file @
e1bc3832
i
9venv/Lib/site-packages/uvicorn/protocols/http/h11_impl.py,8\7\87c1108482c4497c577e9a478a6a458efd708820
K
script/config/app_config.py,e\7\e7a8f69b82d0d0839cd67ff968caeb054957923f
]
-.idea/sonarlint/securityhotspotstore/index.pb,8\8\88a9255124c95bdc913197c120a8d560edc59c8e
E
conf/application.conf,6\4\644f59db746795ef1538ef95c4cbc0eab6663e28
^
..idea/inspectionProfiles/profiles_settings.xml,1\e\1e9075f5bf079c01ef2c910709e91a497d262080
\
,.idea/inspectionProfiles/Project_Default.xml,4\9\496a238a6afa168dbaf6efd37bb459331589579c
\ No newline at end of file
.idea/sonarlint/securityhotspotstore/index.pb
View file @
e1bc3832
i
9venv/Lib/site-packages/uvicorn/protocols/http/h11_impl.py,8\7\87c1108482c4497c577e9a478a6a458efd708820
K
script/config/app_config.py,e\7\e7a8f69b82d0d0839cd67ff968caeb054957923f
]
-.idea/sonarlint/securityhotspotstore/index.pb,8\8\88a9255124c95bdc913197c120a8d560edc59c8e
E
conf/application.conf,6\4\644f59db746795ef1538ef95c4cbc0eab6663e28
^
..idea/inspectionProfiles/profiles_settings.xml,1\e\1e9075f5bf079c01ef2c910709e91a497d262080
\
,.idea/inspectionProfiles/Project_Default.xml,4\9\496a238a6afa168dbaf6efd37bb459331589579c
\ No newline at end of file
Weather Report_daily.xlsx
deleted
100644 → 0
View file @
9ae5b679
File deleted
script/core/handler/send_email.py
View file @
e1bc3832
import
smtplib
import
ssl
from
email.message
import
EmailMessage
from
email.mime.multipart
import
MIMEMultipart
...
...
@@ -6,19 +8,26 @@ class SendEmail:
@
staticmethod
def
send_file
(
sender_email
,
receiver
,
sender_password
):
try
:
with
smtplib
.
SMTP
(
'smtp.gmail.com'
,
587
)
as
smtp
:
msg
=
MIMEMultipart
()
files
=
[
'Weather Report_daily.xlsx'
,
'Weather Report_weekly.xlsx'
,
'Weather Report_monthly.xlsx'
]
msg
=
EmailMessage
()
msg
[
'From'
]
=
sender_email
msg
[
'To'
]
=
receiver
msg
[
'Subject'
]
=
"weather report"
smtp
.
starttls
()
context
=
ssl
.
create_default_context
()
with
open
(
"Weather Report_daily.xlsx"
,
"rb"
)
as
file
:
for
file_read
in
files
:
with
open
(
file_read
,
"rb"
)
as
file
:
print
(
"sjsjhj"
)
file_data
=
file
.
read
()
file_name
=
file
.
name
msg
.
add_attachment
(
file_data
,
maintype
=
"weather"
,
subtype
=
"xlsx"
,
filename
=
file_name
)
print
(
file_name
)
# part['Content-Disposition'] = 'attachment; filename="%s"' % basename(f)
msg
.
add_attachment
(
file_data
,
maintype
=
"application"
,
subtype
=
"xlsx"
,
filename
=
file_name
)
with
smtplib
.
SMTP_SSL
(
'smtp.gmail.com'
,
465
,
context
=
context
)
as
smtp
:
print
(
"skfknk"
)
smtp
.
login
(
sender_email
,
sender_password
)
smtp
.
send_message
(
msg
)
smtp
.
sendmail
(
sender_email
,
receiver
,
msg
.
as_string
())
# smtp.starttls()
except
ValueError
:
raise
ValueError
except
Exception
as
e
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment