Zoho ZeptoMail for Django
Applications built using Django can now use Zoho ZeptoMail to send their transactional emails. This integration supports both text and HTML emails along with attachment support.
Pre-requisites
- Verify the email sending domain
- Generate the Send Mail Token you will use to send emails.
Installation
Add the following installation data in the console.
Copied
Settings configuration
Add the following parameters in the configuration settings - settings.py
Note:
- The default FROM address will be used for all emails sent out from the application.
- It is mandatory to mention the region where your application is hosted. It is optional for applications hosted in US.
Copied
Email sending
There are two ways in which you can send emails using the ZeptoMail plugin. They are :
- Plain text only emails
- Plain text and HTML emails
Text only emails
- Use the following code to send plain text emails using the send_mail function.
Copied
- Use the following code to add multiple recipients - CC, BCC.
Copied
Text and HTML emails
- Use the following code to send text and HTML emails
Copied
- To add other recipients - CC, BCC using the EmailMultiAlternatives class
Copied
Using attachments
You can use attachments while sending emails. There are three methods to add attachments :
- Using file path
Copied
- Using filename and file content
Copied
- Using the MIMEBase instance
Copied
Show full
Show less