A code that help to ease daily life

Ajeetjaiswal
2 min readOct 13, 2020

--

Python is an interpreted, high-level and general-purpose programming language. Created by Guido van Rossum and first released in 1991, Python’s design philosophy emphasizes code readability with its notable use of significant whitespace.

Using python we can able to write some useful which remove our daily task using automation that’s right…..

Using SMTB Library

The smtplib module defines an SMTP client session object that can be used to send mail to any Internet machine with an SMTP or ESMTP listener daemon. For details of SMTP and ESMTP operation, consult RFC 821 (Simple Mail Transfer Protocol) and RFC 1869 (SMTP Service Extensions).

Now here are the codes after installing Smtb lib using pip

#Frist import smtlib : This is use for make connection with server
import smtplib

Code

# Define a fnction which we can call later
def sender_mail():
# define the sende_email which you wan’t to mail with
sender_email = “xyz@mail.com
# ENter the pass word of your mail you can also assign his in other file and hen import it on main file
password = input(str(“Please enter your password: “))
# Enter the recieve mail for which you want to make the mail recieve
rec_email = input(str(“enter the emails where email have to be sent: “))
# define subject desigm or structure
message = ‘Subject: {}\n\n{}’.format(subject, msg)
server = smtplib.SMTP(‘smtp.gmail.com’ , 587)
server.starttls()
server.login(sender_email, password)
print(“login success”)
server.sendmail(sender_email, rec_email, message)
print(“Email has benn sent to “, rec_email)

subject = ‘’ Write your Subject here
msg = ‘Enter you message here’

Hope you like this smaill article if this help you in any way please let me kow

Thanks

--

--

Ajeetjaiswal
Ajeetjaiswal

Written by Ajeetjaiswal

Developer 😃 freelancer, Musician 🎸🎧,Creative Engineer writing working hypotheses

No responses yet