-
Notifications
You must be signed in to change notification settings - Fork 2
/
EmailSender.py
42 lines (29 loc) · 2.11 KB
/
EmailSender.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
from email.message import EmailMessage
import ssl
import smtplib
def Email_Generation():
print("---------------Welcome To The Email Sender----------------")
print(" ")
print(" ")
email_sender = "sharmaalok02gwl@gmail.com"
email_password = 'tmmivpefygzatenf'
email_reciever = input("Enter Your Mail: ")
subject = "This is A Python Test. Don't Reply To This Mail.This is A Computer generated Mail."
# subject = input('Enter The Subject :')
#body = input("Enter The Body And Content You Want To Send: ")
body = """Python is a high-level programming language that is widely used for various applications,including web development, scientific computing, data analysis, artificial intelligence, and more.It was first released in 1991 by Guido van Rossum and has since become one of the most popular programming languages in the world.Python is known for its simplicity, readability, and ease of use, making it a great choice for beginners and experts alike.It has a vast library of modules and packages that can be used to extend its functionality,and its dynamic typing and automatic memory management make it a flexible language for many use cases. Whether you're building a simple script or a complex application, Python is a powerful tool that can help you get the job done efficiently and effectively.
Dear User,
I am writing to inform you that this email has been automatically generated by a computer program.Please do not respond to this message as it is not being monitored.If you have any questions or concerns, please feel free to contact us at sharmaalok02gwl@gmail.com .We will be happy to assist you in any way we can.Thank you for your understanding.
Best regards,
Atul Sharma
"""
em = EmailMessage()
em['From'] = email_sender
em['To'] = email_reciever
em['Subject'] = subject
em.set_content(body)
context = ssl.create_default_context()
with smtplib.SMTP_SSL('smtp.gmail.com', 465, context = context) as smtp:
smtp.login(email_sender, email_password)
smtp.sendmail(email_sender, email_reciever, em.as_string())
Email_Generation()