Examples
Python SMTP Integration
Detailed documentation for the Python Shoutbox SMTP integration
Python SMTP Integration
The Shoutbox Python library provides SMTP support for sending emails through our SMTP servers, offering an alternative to the REST API.
SMTP vs API Client
When to Use SMTP
- Legacy system integration
- Firewall restrictions on HTTP
- Specific SMTP requirements
- Need for custom SMTP settings
- Direct server-to-server communication
When to Use API Client
- Modern application development
- RESTful architecture
- Webhook support needed
- Advanced analytics required
- Simpler implementation preferred
Installation
Install using pip:
Basic Usage
Simple Email
Multiple Recipients
With Attachments
Advanced Configuration
Custom SMTP Settings
Custom Headers
Error Handling
Configuration Options
Client Settings
Option | Type | Default | Description |
---|---|---|---|
api_key | str | None | Your API key |
host | str | smtp.shoutbox.net | SMTP server hostname |
port | int | 587 | SMTP server port |
use_tls | bool | True | Whether to use TLS |
timeout | int | 30 | Connection timeout in seconds |
Security Considerations
-
TLS Usage
- Always use TLS in production
- Verify SSL certificates
- Use secure ports (587/465)
-
Authentication
- Use API key for authentication
- Store credentials securely
- Use environment variables
-
Network Security
- Configure firewalls appropriately
- Monitor SMTP logs
- Set appropriate timeouts
Best Practices
Connection Management
Bulk Sending
Error Recovery
Testing
Mock SMTP Client
Troubleshooting
Common Issues
-
Connection Errors
- Check network connectivity
- Verify firewall settings
- Confirm port availability
-
Authentication Failures
- Verify API key
- Check credentials
- Confirm TLS settings
-
Timeout Issues
- Adjust timeout settings
- Check network latency
- Monitor server response time
Logging
Migration
From API to SMTP
Support
- Technical documentation
- GitHub Issues
- Email support
- Regular updates
- Security patches