Dhesend

Python

Flask

Learn how to send emails in Flask using Dhesend Python SDK.

Prerequisites
To get the most out of this guide, you’ll need to:
1. Install
Install the Dhesend Python SDK.
1pip install dhesend
2. Send email using html

The easiest way to send an email is by using the html parameter.

1from dhesend import Dhesend, SendEmailPayload
2from flask import Flask, jsonify
3
4app = Flask(__name__)
5
6@app.route("/send-email")
7def send_email():
8    dhesend = Dhesend("your-apikey")
9    
10    params: SendEmailPayload = {
11        "from": "Dhesend <example@domain.com>",
12        "to": ["example@dhesend.com"],
13        "subject": "Welcome to Dhesend",
14        "htmlBody": "<strong>Have a nice day!</strong>",
15    }
16
17    response = dhesend.Email.send(params)
18    return jsonify(response)
19
20if __name__ == "__main__":
21    app.run()

Dhesend @ 2024 - Made with ❤ by  DHEM