Write an Automation Python Code to send Emails without manual work.
In college, I struggled to send emails to numerous people about an event. So, I created an automated Python script to handle the task effortlessly. Now, my project saves me time and effort, enabling me to focus on writing. It’s a game-changer, simplifying reaching out to my audience without any manual intervention.
Let’s discuss the creation of the Project.
Note:- You must install Anaconda Software which contains Jupyter, Python and many more useful components related to programming.
Firstly, I will open Jupyter Notebook from the command prompt.
Write the word Jupyter Notebook in the terminal.
After that, Jupyter will open automatically. Where I had written code. Let me explain further ahead.
smtplib
is a Python library used to send emails and the valuable lines include importing the module, creating an SMTP object, logging in, and sending emails using sendmail()
or send_message()
.
TLS (Transport Layer Security) is a cryptographic protocol that enhances the security of data transmitted over networks, such as the Internet. In the context of smtplib
, TLS is used to establish a secure encrypted connection between the email client and the email server, ensuring that sensitive information, including login credentials and email content, remains protected from eavesdropping and tampering during transmission. To enable TLS, you can use the starttls()
method in smtplib
.
Now, I have to share the password of the sender's email to give authentication access.
Clicking the Security then click on two passwords after that click on App Passwords.
Write Python or anything, It will generate the app password.
Now, it will share the password, and see below, it shows like 👇.
Done, Next, we will write inside s.login(xx, xx) . I mean the sender email id and sender app password.
Now we have to write first sender email, receiver email , and message.
At last, I will quit the session using s.quit().
See Evidence of My Project What I have received in my web Gmail Account.
Now, the mission accomplished of creating this awesome project.
Thanks @Vimal Daga Sir for guiding me.
So, whether you’re a tech enthusiast, a professional, or just someone who wants to learn more, I invite you to follow me on this journey. Subscribe to my blog and follow me on social media to stay in the loop and never miss a post.
Together, let’s explore the exciting world of technology and all that it has to offer. I can’t wait to connect with you!”