Coders Packet

Send PDF files through emails using Python

By Suryansh Mamgain

A python script to send pdf files through your email using pdf_mail module of python.

Requirements:

    1. pdf_mail module doesn't come with python, therefore you need to install this module by using the command given below:

       pip install pdf-mail

Methodology:

    1. Import sendpdf from the pdf_mail module

    2. Provide the following details asked:

         a) sender email address

         b) sender email password

         c) receiver email address

         d) subject of the mail

         e) body of the mail

         f) filename

         g) location of the file

    3. Create an object of the sendpdf function and pass all the details in this object

    4. Call email-send() method.

          #email_send():  It will send the pdf document from your Gmail account to another Gmail account. 

NOTE:

Before running the code you have to update the Google account settings for sending an email.

account.google.com -> less secure apps -> Turn on access

Download Complete Code

Comments

No comments yet