Python 3 Script to Send PDF File Through Email Using pdf-mail Library Full Project For Beginners

Python 3 Script to Send PDF File Through Email Using pdf-mail Library Full Project For Beginners

 

 

 

Welcome folks today in this blog post we will be sending pdf file though email using pdf-mail library. The source code of this tutorial will be given below.

 

 

Get Started

 

 

In order to get started you need to install pdf-mail library using the pip command

 

pip install pdf-mail

 

Now we want to create app.py file and copy paste the following code

 

 

app.py

 

 

# Importing sendpdf function 
# From pdf_mail Library 
from pdf_mail import sendpdf 


# Create an object of sendpdf function 
k = sendpdf("##sender##email", 
            "###receiveremail###", 
            "##senderemailpassword##", 
            "##subject of message###", 
            "##bodyofmessage###", 
            "###filename###", 
            "###pathoffile###") 

# sending an email 
k.email_send()

 

 

 

Now in this python script we need to replace the appropriate values

 

sender's email address

receiver's email address

sender's password

body of mail

subject of mail

filename

filepath

Before executing this script you need to turn on secure apps access for your gmail account to send emails on your behalf account.

See also  Python 3 Tkinter Distance Converter Script Miles to Kilometres (KM) GUI Desktop App Full Project For Beginners

 

 

 

 

 

 

Now if you execute this python script app.py you will see following result

 

 

 

 

Now you can see the email address received in which the pdf file is there.

 

 

Leave a Reply