hotmail-flask-mailer is a Flask-based library for sending emails through Microsoft's Hotmail/Outlook service using the mailer package. This library provides a simple API for saving email credentials and sending emails.
- Easily send emails through a Flask API endpoint.
- Save email credentials securely within your application.
- Simple, lightweight, and easy to integrate with your Flask projects.
To install hotmail-flask-mailer, use pip:
pip install hotmail-flask-mailerEnsure you also have Flask and the mailer package installed:
pip install Flask mailerYou can use hotmail-flask-mailer by running the Flask application provided in the package. Here's a simple guide to get you started:
# app.py
from hotmail_flask_mailer.app import mailer_instance, app
# Run the Flask app
if __name__ == "__main__":
app.run(debug=True)Use the save function to store your email credentials securely:
from hotmail_flask_mailer.app import mailer_instance
# Save your Hotmail credentials
mailer_instance.save(email="[email protected]", password="your_password")Once credentials are saved, use the send function to send an email:
# Send an email
status = mailer_instance.send(
receiver="[email protected]",
subject="Hello from Hotmail",
message="This is a test message sent using Hotmail Flask Mailer."
)
# Check if the email was sent successfully
if status:
print("Email sent successfully!")
else:
print("Failed to send email.")Alternatively, you can send emails by making a POST request to the /send_email endpoint of the running Flask app:
POST /send_email
Content-Type: application/json
{
"email": "[email protected]",
"password": "your_password",
"receiver": "[email protected]",
"subject": "Hello from Hotmail",
"message": "This is a test message sent using Hotmail Flask Mailer."
}To run the application:
-
Save your
app.pyas shown above. -
Run the Flask app:
python app.py
Contributions are welcome! Please feel free to submit a Pull Request or open an Issue.
If you have any questions or need help, feel free to open an issue on GitHub.