Email Service Integration

Email Service Integration

Teaches an AI agent to add email sending to backends with SMTP and providers like SendGrid, templates, validation and asynchronous delivery.

Skill files8 files

references/

scripts/

templates/

SKILL.md104 lines
1
---
2
name: email-service-integration
3
description: >
4
Integrate email services with backends using SMTP, third-party providers,
5
templates, and asynchronous sending. Use when implementing email
6
functionality, sending transactional emails, and managing email workflows.
7
---
8
9
# Email Service Integration
10
11
## Table of Contents
12
13
- [Overview](#overview)
14
- [When to Use](#when-to-use)
15
- [Quick Start](#quick-start)
16
- [Reference Guides](#reference-guides)
17
- [Best Practices](#best-practices)
18
19
## Overview
20
21
Build comprehensive email systems with SMTP integration, third-party email providers (SendGrid, Mailgun, AWS SES), HTML templates, email validation, retry mechanisms, and proper error handling.
22
23
## When to Use
24
25
- Sending transactional emails
26
- Implementing welcome/confirmation emails
27
- Creating password reset flows
28
- Sending notification emails
29
- Building email templates
30
- Managing bulk email campaigns
31
32
## Quick Start
33
34
Minimal working example:
35
36
```python
37
# config.py
38
import os
39
40
class EmailConfig:
41
MAIL_SERVER = os.getenv('MAIL_SERVER', 'smtp.gmail.com')
42
MAIL_PORT = int(os.getenv('MAIL_PORT', 587))
43
MAIL_USE_TLS = os.getenv('MAIL_USE_TLS', True)
44
MAIL_USERNAME = os.getenv('MAIL_USERNAME')
45
MAIL_PASSWORD = os.getenv('MAIL_PASSWORD')
46
MAIL_DEFAULT_SENDER = os.getenv('MAIL_DEFAULT_SENDER', 'noreply@example.com')
47
48
# email_service.py
49
from flask_mail import Mail, Message
50
from flask import render_template_string
51
import logging
52
from datetime import datetime
53
import smtplib
54
from email.mime.text import MIMEText
55
from email.mime.multipart import MIMEMultipart
56
57
logger = logging.getLogger(__name__)
58
mail = Mail()
59
60
class EmailService:
61
def __init__(self, app=None):
62
// ... (see reference guides for full implementation)
63
```
64
65
## Reference Guides
66
67
Detailed implementations in the `references/` directory:
68
69
| Guide | Contents |
70
|---|---|
71
| [Python/Flask with SMTP](references/pythonflask-with-smtp.md) | Python/Flask with SMTP |
72
| [Node.js with SendGrid](references/nodejs-with-sendgrid.md) | Node.js with SendGrid |
73
| [Email Templates with Mjml](references/email-templates-with-mjml.md) | Email Templates with Mjml |
74
| [FastAPI Email with Background Tasks](references/fastapi-email-with-background-tasks.md) | FastAPI Email with Background Tasks |
75
| [Email Validation and Verification](references/email-validation-and-verification.md) | Email Validation and Verification |
76
77
## Best Practices
78
79
### ✅ DO
80
81
- Use transactional email providers for reliability
82
- Implement email templates for consistency
83
- Add unsubscribe links (required by law)
84
- Use background tasks for email sending
85
- Implement proper error handling and retries
86
- Validate email addresses before sending
87
- Add rate limiting to prevent abuse
88
- Monitor email delivery and bounces
89
- Use SMTP authentication
90
- Test emails in development environment
91
92
### ❌ DON'T
93
94
- Send emails synchronously in request handlers
95
- Store passwords in code
96
- Send sensitive information in emails
97
- Use generic email addresses for sensitive operations
98
- Skip email validation
99
- Ignore bounce and complaint notifications
100
- Use HTML email with inline styles excessively
101
- Forget to handle failed email deliveries
102
- Send emails without proper templates
103
- Store email addresses without consent
104

© AJ Geddes · MIT · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 14,621 prompts

More by @OpenSourceBuffGuy

See all
Sea turtle carrying floating film studio island prompt image

Sea turtle carrying floating film studio island

Draws a giant sea turtle carrying a floating island film studio through a starry sky, where fairies polish rough film strips into golden film.

image-prompt, nano-banana, 3d-render, cartoon, fantasy-world, creatures, animals, whimsical, dreamy, cinematic, dramatic-lighting, vibrant-colors, bokeh, miniature, widescreen, night-scene, illustration, concept-art, surreal, storytelling, clay-3d

Desert buggy escapes drones past industrial outpost prompt image

Desert buggy escapes drones past industrial outpost

Builds a 15-second desert chase video where a racer in an armored buggy escapes drones past an industrial outpost, using five reference images with set jobs.

video-prompt, hailuo, action, multi-shot, timed-beats, camera-movement, reference-image, character-consistency, negative-prompt, cinematic, sci-fi, cars, landscape, aerial-view, tracking-shot, photorealistic, sound-effects, structured-output, long-form, widescreen

1 view
Cozy Pixel Art Farm Island Village prompt image

Cozy Pixel Art Farm Island Village

Draws a cozy 16-bit pixel-art farming village across six small islands joined by bridges, with exact counts for buildings, animals and crops.

image-prompt, gpt-image, pixel-art, isometric, game-assets, concept-art, maps, worldbuilding, cozy, vibrant-colors, ocean, landscape, wide-shot, widescreen, game-development, video-games, structured-output, whimsical, summer, high-angle, aerial-view, animals, negative-prompt, cityscape

1 view

Reviews

Loading reviews…

Discussion

Loading comments…