https://serve.faux-api.com/tokenNo/cache_clearSMTP Relay (Mailer) Integration Guide
Faux API's SMTP Relay Service provides a unified, secure, and globally distributed way to send transactional emails from your applications. Instead of managing complex mail server configurations, you can use our simple POST endpoint to deliver emails instantly.
Getting Started: Basic Configuration
Before you can send emails, you must configure your SMTP credentials in the Faux-API dashboard under your project settings. Once configured, you can use your project's faux_auth_token to authenticate requests.
API Endpoint
Request Body (JSON)
Your request must be a POST request with a JSON body containing the following fields:
| Field | Type | Description |
|---|---|---|
to | string | Recipient email address. |
subject | string | Subject line of the email. |
body | string | HTML or plain text content of the email. |
fromName | string (optional) | Display name for the sender. |
JavaScript Implementation
Here is how you can send an email using the native fetch API in JavaScript:
fetch('https://smtp.faux-api.com/send', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_FAUX_AUTH_TOKEN'
},
body: JSON.stringify({
to: 'recipient@example.com',
subject: 'Hello from Faux API',
body: '<h1>Welcome!</h1><p>This is a test email via Faux SMTP Relay.</p>',
fromName: 'My Awesome App'
})
})
.then(response => response.json())
.then(data => {
if (data.status === 'success') {
console.log('Email sent successfully!');
} else {
console.error('Failed to send email:', data.message);
}
})
.catch(error => console.error('Error:', error));
Real-Time Delivery Logs
Every email processed through our relay is logged in real-time. You can view these logs in your project dashboard to track delivery status, bounces, and potential errors. This transparency helps you troubleshoot issues instantly without digging through server logs.
Note: Ensure your project has an active plan with SMTP quotas. You can check your current limits in the Pricing Section.
Best Practices
- Secure Your Token: Never expose your
faux_auth_tokenin client-side code. Always trigger mailer calls from your backend. - HTML Content: Our relay supports full HTML bodies. Use inline styles for better compatibility across email clients.
- Rate Limiting: Respect your plan's hourly and daily limits to ensure continuous delivery service.