New to SMTP? Check out our SMTP credentials guide to get started, or try our HTTP API for a more modern approach.
Server Endpoints
AhaSend operates SMTP servers in multiple regions for optimal performance:European Server
Hostname:
Location: Germany (Primary)
Best for: European and global traffic
send.ahasend.com
Location: Germany (Primary)
Best for: European and global traffic
US Server
Hostname:
Location: Oregon, USA
Best for: North American traffic
send-us.ahasend.com
Location: Oregon, USA
Best for: North American traffic
Server selection: Choose the server closest to your application for best performance. Both servers offer identical functionality and delivery capabilities.
Connection Settings
Supported Ports & Encryption
All AhaSend SMTP servers support the following configurations:SMTPS not supported: AhaSend does not support implicit SSL/TLS (SMTPS) on port 465. Use STARTTLS on ports 25, 587, or 2525 instead.
Authentication Requirements
- Authentication Method: PLAIN authentication over STARTTLS
- Username: Your SMTP username from the dashboard
- Password: Your SMTP password from the dashboard
- STARTTLS: Required for all connections
Get SMTP credentials: Create SMTP credentials in your AhaSend Dashboard in the “Credentials” page or via the API.
Connection Limits & Specifications
Understanding AhaSend’s SMTP limits helps you optimize your email sending:Recipients Per Message
Recipients Per Message
Limit: 50 recipients maximum per messageThis is the maximum number of consecutive
RCPT TO
commands that can be issued for a single SMTP transaction.For bulk sending to more recipients, send multiple separate messages or use our HTTP API with batch operations.
Message Size Limit
Message Size Limit
Limit: 20 MB maximum per messageMessages exceeding this size will be rejected with an error code. This includes:
- Email headers
- Message body (text and HTML)
- All attachments (base64 encoded)
Remember that attachments are base64 encoded, increasing their size by approximately 33%. A 15MB file becomes ~20MB when encoded.
Messages Per Connection
Messages Per Connection
Limit: 10,000 messages maximum per connectionThis is the maximum number of consecutive
MAIL FROM
commands that can be issued for a single SMTP connection.When this limit is reached:- Additional
MAIL FROM
commands return transient failures - You should close and reopen the connection
- Existing queued messages are not affected
Most SMTP libraries handle connection pooling automatically, but you may need to configure this for high-volume applications.
Connection Timeout
Connection Timeout
Timeout: 1 minute of inactivityConnections are automatically closed if there’s no new data within 60 seconds. This applies to:
- Idle connections between commands
- Slow data transmission during
DATA
command - Unresponsive clients
Keep connections active or implement proper reconnection logic in your application to handle timeouts gracefully.
SMTP Response Codes
AhaSend returns standard SMTP response codes with specific meanings:Success Codes
Code | Description |
---|---|
250 | OK - Message queued successfully for delivery |
Error Codes
Code | Description | Action Required |
---|---|---|
421 | Load shedding - Server overwhelmed, cannot accept new connections | Retry later with exponential backoff |
451 | Internal server error - Temporary server issue | Retry the request |
500 | Invalid credentials - Authentication failed | Check username/password |
521 | Account disabled - Account suspended or out of credits | Check account status in dashboard |
552 | Invalid message format - Malformed email content | Validate email structure and headers |
553 | Email rejected - Recipient domain is toxic, temporary, or has typos | Verify recipient domain |
556 | Invalid account or domain - Account or sending domain not configured | Verify domain setup |
553 email Rejection: This response is only returned if you enable Recipient Shields in your Account Settings.
Special Headers
AhaSend supports special email headers that modify system behavior:Custom Headers
Learn about custom headers for tracking, routing, and advanced email features
Example Configurations
Basic SMTP Configuration
Programming Language Examples
Node.js
Nodemailer and native SMTP examples
Python
smtplib and popular framework integrations
PHP
PHPMailer and framework examples
Go
Native Go SMTP implementations
.NET
C# and .NET Core examples
Command Line
sendmail, swaks, and curl examples
Best Practices
Connection Management
Connection Management
Optimize your SMTP connections:
- Reuse connections when sending multiple emails
- Implement connection pooling for high-volume sending
- Handle timeouts and reconnections gracefully
- Close connections properly when done
Error Handling
Error Handling
Handle SMTP errors appropriately:
- Implement exponential backoff for
421
responses - Retry
451
errors with reasonable delays - Don’t retry
5xx
errors (permanent failures) - Log error codes for debugging and monitoring
Performance Optimization
Performance Optimization
Maximize sending performance:
- Use persistent connections for batch sending (up to 10k messages per connection)
- Choose the server closest to your application
- Monitor connection limits and adjust accordingly
Security Considerations
Always use STARTTLS: Unencrypted SMTP connections are not secure and may expose your credentials and email content.
Credential Security
- Store SMTP credentials securely
- Use environment variables, not hardcoded values
- Rotate credentials regularly
- Use scoped credentials when possible
Domain Authentication
- Verify your sending domains
- Configure SPF, DKIM, and DMARC records
- Use dedicated sending domains
- Monitor domain reputation
Prefer HTTP API? While SMTP is great for compatibility, our HTTP API offers better performance, features, and error handling for modern applications.