Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Go to Haptik Website
  • Contact Us
  • Home
  • Bot Building
  • Essentials

Sending Emails From Haptik Platform

Written by Product Team

Updated on April 8th, 2025

Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Getting Started
    Build Deploy Analyse Manage Account Bot Deactivation
  • Bot Building
    Essentials Smart Skills Steps User Messages Bot Responses Entities Connections Customisations User feedback collection Testing Whatsapp Bots NLU Bot Maintenance
  • Smart Agent Chat
    Set up Admin Settings MyChats Section (Agent Inbox) Live Traffic Section Teams Section Archives Section Analytics Plans on Smart Agent Chat
  • Conversation Design
    Design Basics Design Guides Designing for Platforms Designing WhatsApp Bots
  • Developer Guides
    Code Step Integration Static Step Integration Shopify Integration SETU Integration Exotel Integration CIBIL integration Freshdesk KMS Integration PayU Integration Zendesk Guide Integration Twilio Integration Razorpay Integration LeadSquared Integration USU(Unymira) Integration Helo(VivaConnect) Integration Salesforce KMS Integration Stripe Integration PayPal Integration CleverTap Integration Fynd Integration HubSpot Integration Magento Integration WooCommerce Integration Microsoft Dynamics 365 Integration
  • Deployment
    Web SDK WhatsApp Facebook Instagram Sunshine Conversation LINE Google Business Messages Telegram MS Teams Bot as an API iOS SDK Android SDK
  • External Agent Tool Setup
    Zendesk Chat Salesforce Service Cloud Freshchat Zoho NICE CXOne Gorgias
  • Analytics & Reporting
    Intelligent Analytics
  • Notifications
    SMS Notifications Success Measurement
  • Commerce Plus
    Catalog Integration Bot Building Guide Channel Deployments Unified ML Pipeline Documentation
  • Troubleshooting Guides
    Error Messages FAQs
  • Release Notes
+ More

Table of Contents

Overview 🔧 Use Cases 🧱 Prerequisites ✉️ Sending Email with EmailMessage in Haptik Platfrom ✅ Example 📂 Attachments Support 🔁 HTML Emails (Optional Enhancement) 📌 Notes 🛡️ Security Tip

Overview

Our platform includes built-in support for sending emails. This feature enables sending transactional or notification-based emails using a flexible, programmatic interface.

🔧 Use Cases

  • User registration confirmations
  • Password reset links
  • System alerts or status updates 
  • Custom email notifications
     

🧱 Prerequisites

Ensure the following settings are configure:( this is configured already in Haptik)

# settings.py

 

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'

EMAIL_HOST = '<your-smtp-host>'

EMAIL_PORT = 587  # or 465 for SSL

EMAIL_USE_TLS = True  # or EMAIL_USE_SSL = True

EMAIL_HOST_USER = '<your-email-address>'

EMAIL_HOST_PASSWORD = '<your-email-password>'

DEFAULT_FROM_EMAIL = ‘<your-default-sender>’

✉️ Sending Email with EmailMessage in Haptik Platfrom

The platform utilizes Django's EmailMessage class to send out emails. Here's how to use it:

from django.core.mail import EmailMessage

 

def send_custom_email(subject, body, to_emails, from_email=None, attachments=None):

    email = EmailMessage(

        subject=subject,

        body=body,

        from_email=from_email or DEFAULT_FROM_EMAIL,

        to=to_emails,

    )

 

    # Optional: Attach files

    if attachments:

        for attachment in attachments:

            email.attach_file(attachment)

 

    # Send the email

    email.send(fail_silently=False)

✅ Example

send_custom_email(

    subject="Welcome to Our Platform!",

    body="Hi there,\n\nThank you for signing up. We're glad to have you!",

    to_emails=["user@example.com"]

)

 

📂 Attachments Support

You can attach files like PDFs, CSVs, images, etc., using the attach_file() method:

python

CopyEdit

email.attach_file('/path/to/file.pdf')

 

🔁 HTML Emails (Optional Enhancement)

For HTML content, use Django’s EmailMultiAlternatives:

python

CopyEdit

from django.core.mail import EmailMultiAlternatives

 

email = EmailMultiAlternatives(

    subject="HTML Email Example",

    body="This is the fallback plain text version.",

    from_email=DEFAULT_FROM_EMAIL,

    to=["user@example.com"],

)

html_content = "<p>This is an <strong>HTML</strong> message.</p>"

email.attach_alternative(html_content, "text/html")

email.send()

 

📌 Notes

  • Ensure the SMTP credentials are correct and have permission to send emails.
  • Monitor for delivery failures or SMTP issues.
  • Use environment variables to store sensitive email credentials securely.

🛡️ Security Tip

Avoid hardcoding sensitive information like passwords. Use environment variables or a secrets manager.

Was this article helpful?

Yes
No
Give feedback about this article

Related Articles

  • How to Set Up Zendesk Guide Integration on Haptik bot
  • What to do when not able to add a user on Haptik?
  • How to deploy Haptik's bot on Google Business Messages?

Platform

  • Conversation Studio
  • Smart Skills
  • Advanced NLU
  • Intelligent Analytics
  • Omnichannel
  • Smart Agent Chat
  • Enterprise Security
  • Integrations

Solutions

  • Conversational Commerce
  • Lead Generation
  • Customer Care
  • WhatsApp
  • Conversational IVR
  • Google Business Messages

Industries

  • Retail/ E-Commerce
  • Financial Services
  • Travel & Hospitality
  • Telecom

Knowledge

  • ROI Calculator
  • Reports & Research
  • Case Studies
  • Webinars
  • ISAT
  • Tech Blog
  • Business Blog
  • Resources
  • Haptik v/s Yellow
  • Haptik v/s Liveperson
  • Haptik v/s IBM Watson
  • Haptik v/s Verloop
  • Conversations on AI

Company

  • Why Haptik
  • About Us
  • Careers
  • News & Media
  • Awards & Recognition
  • Contact Us
  • Partnerships
  • Investor Relations

Subscribe

Sign up to recieve the latest updates

Find us on

  • Twitter-footer
  • Linkedin-footer
  • YT-footer
  • Insta-footer
  • G2-footer
  • Facebook-footer

Knowledge Base Software powered by Helpjuice

Copyright © jio Haptik Technology Limited 2021 | Data Security & Privacy Policy | GDPR

North America | Asia Pacific | Africa | enterprise@haptik.ai

Definition by Author

0
0