The Wayback Machine - https://web.archive.org/web/20240717024331/https://www.geeksforgeeks.org/send-pdf-file-through-email-using-pdf-mail-module/
Open In App

Send PDF File through Email using pdf-mail module

Last Updated : 16 Jul, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

pdf_mail module is that library of Python which helps you to send pdf documents through your Gmail account.

Installing Library

This module does not come built-in with Python. You need to install it externally. To install this module type the below command in the terminal.

pip install pdf-mail

Function of pdf_mail

This module only comes with a single functionality of sending mail from one account to another. The function used to do the same is –

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

Note :

  • It should be noted that the address_of_file must contain forward slash (/) .
  • You have to update the google account settings for sending a email .
    account.google.com -> less secure apps -> Turn on access .

Below is the implementation.




# Importing sendpdf function  
# From pdf_mail Library   
from pdf_mail import sendpdf
  
# Taking input of following values
# ex-"abcd@gmail.com" 
sender_email_address = input() 
  
# ex-"xyz@gmail.com" 
receiver_email_address = input() 
  
# ex-" abcd1412" 
sendere_email_password = input()
  
# ex-"Heading of email"
subject_of_email = input()    
   
# ex-" Matter to be sent"
body_of_email = input()
   
# ex-"Name of file" 
filename = input()        
  
# ex-"C:/Users / Vasu Gupta/ "
location_of_file = input() 
  
  
# Create an object of sendpdf function 
k = sendpdf(sender_email_address, 
            receiver_email_address,
            sender_email_password,
            subject_of_email,
            body_of_email,
            filename,
            location_of_file)
  
# sending an email
k.email_send()




Similar Reads

How to extract Email column from Excel file and find out the type of mail using Pandas?
In this article, Let's see how to Extract Email column from an Excel file and find out the type of mail using Pandas. Suppose our Excel file looks like below given image, and then we have to store different type of emails in different columns of Dataframe. For viewing the Excel file Click Here Approach: Import required module.Import data from Excel
3 min read
Send mail with attachment from your Gmail account using Python
In last article, we have discussed the basics of sending a mail from a Gmail account without any subject as well as without any attachment. Today, we will learn how to send mail with attachment and subject using Python. Before moving on, it is highly recommended to learn how to send a simple mail using Python and learn the basics working of 'smtpli
4 min read
Send Email Using yagmail in Python
In this article, we are going to see how to send email using yagmail. yagmail(Yet Another Gmail) is a module in python which used to send emails using Python. This module is nothing, just a Gmail/SMTP(Simple Mail Transfer Protocol) client that removes the issues of sending emails through Python. This helps the Web App to interact with Gmail without
3 min read
How to Send Automated Email Messages in Python
In this article, we are going to see how to send automated email messages which involve delivering text messages, essential photos, and important files, among other things. in Python. We'll be using two libraries for this: email, and smtplib, as well as the MIMEMultipart object. This object has multiple subclasses; these subclasses will be used to
6 min read
Send Message on Instagram Using Instabot module in Python
In this article, we are going to see how to send messages on Instagram using the Instabot module in Python. Instagram is a nice platform for chatting but when it comes to sending the same message to all friends this is a really boring and time-consuming task especially if you have a large number of followers. To make this easy we make a bot using P
2 min read
How to convert PDF file to Excel file using Python?
In this article, we will see how to convert a PDF to Excel or CSV File Using Python. It can be done with various methods, here are we are going to use some methods. Method 1: Using pdftables_api Here will use the pdftables_api Module for converting the PDF file into any other format. It's a simple web-based API, so can be called from any programmin
2 min read
How to convert CSV File to PDF File using Python?
In this article, we will learn how to do Conversion of CSV to PDF file format. This simple task can be easily done using two Steps : Firstly, We convert our CSV file to HTML using the PandasIn the Second Step, we use PDFkit Python API to convert our HTML file to the PDF file format. Approach: 1. Converting CSV file to HTML using Pandas Framework. P
3 min read
How to convert a PDF file to TIFF file using Python?
This article will discover how to transform a PDF (Portable Document Format) file on your local drive into a TIFF (Tag Image File Format) file at the specified location. We'll employ Python's Aspose-Words package for this task. The aspose-words library will be used to convert a PDF file to a TIFF file. Aspose-Words: Aspose-Words for Python is a pot
3 min read
Convert Docx to Pdf using docx2pdf Module in Python
Tired of having to use online docx to PDF converters with crappy interfaces and conversion limits? Then, look no further than your friendly neighborhood language python's docx2pdf module. This module is a hidden gem among the many modules for the python language. This module can be used to convert files singly or in bulk using the command line or a
2 min read
Python program to extract Email-id from URL text file
Prerequisite : Pattern Matching with Python Regex Given the URL text-file, the task is to extract all the email-ids from that text file and print the urllib.request library can be used to handle all the URL related work. Example : Input : Hello This is Geeksforgeeks review-team@geeksforgeeks.org review-team@geeksforgeeks.org GfG is a portal for gee
1 min read
Practice Tags :
three90RightbarBannerImg