Launch Front Chat
Skip to content

SMTP vs REST API

This guide covers both methods for sending transactional emails in Sender — SMTP relay and REST API — so you can choose and configure the one that fits your application.

Prerequisites

  • An active Sender account with transactional email access enabled
  • An API access token (for REST API) or SMTP user credentials (for SMTP), generated from Account settingsAPI access tokens or Transactional emailsSetup instructionsSMTP
  • Access to your application code, server configuration, or CMS admin panel where outgoing email settings are managed

Where to Find This Setting

In the Sender dashboard, go to Transactional emailsSetup instructions.

This page displays configuration tabs for each supported sending method: curl://, Laravel, php, node, and SMTP. Select the tab that matches your integration. The curl, Laravel, php, and node tabs provide REST API–based configuration. The SMTP tab displays server credentials and lets you create SMTP users.

For API token management, go to Account settingsAPI access tokens.

Steps to Configure SMTP or REST API Sending

Step 1 — Choose Your Sending Method

Decide between REST API and SMTP based on your application’s requirements.

Use REST API when your application can make HTTP requests directly. API offers structured JSON request and response handling, making it easier to debug and integrate programmatically. It is the recommended method for custom applications and modern frameworks.

Use SMTP when your application or CMS only supports SMTP-based email delivery — for example, WordPress, legacy systems, or applications with a built-in SMTP configuration panel.

Step 2 — Configure REST API Sending

Navigate to Transactional emailsSetup instructions and select the tab matching your environment (e.g., curl://, php, node).

Set the endpoint to:

POST https://api.sender.net/v2/message/send

Add the following headers to every request:

Accept: application/json
Content-Type: application/json
Authorization: Bearer YOUR_TOKEN_HERE

Replace YOUR_TOKEN_HERE with the API token from Account settingsAPI access tokens.

In the request body, include the from, to, subject, and html fields:

{
  "from": {
    "email": "you@yourdomain.com",
    "name": "Your Name"
  },
  "to": {
    "email": "recipient@example.com",
    "name": "Recipient Name"
  },
  "subject": "Your Subject Line",
  "html": "<p>Your email content</p>"
}

A successful request returns a JSON response confirming the message was accepted for delivery.

Step 3 — Configure SMTP Sending

Navigate to Transactional emailsSetup instructions and select the SMTP tab. Click Add SMTP user to generate your SMTP credentials (username and password).

Configure your application to connect using the following server settings:

Server: smtp.sender.net
Port: 25, 2525, or 587

Authentication: PLAIN or LOGIN over TLS

Enter the SMTP username and password generated in the previous step as your authentication credentials. Port 587 with TLS is recommended for most environments. Use port 2525 as a fallback if port 587 is blocked by your hosting provider.

Step 4 — Set the Sender Identity

For REST API, set the from object in the request body with the email and name fields. The email value must be a verified sender address in your Sender account.

For SMTP, configure the “From” address and display name in your application’s email settings or in the email headers your application generates. The from address must match a verified domain or sender in your account.

Step 5 — Send a Test Email

For REST API, send a request to https://api.sender.net/v2/message/send with a valid recipient address you can access. Check the HTTP response — a successful send returns a confirmation in the JSON response body.

For SMTP, trigger a test email through your application’s email test function or send a test message from your code. Check that your SMTP client connects without authentication errors.

How to Verify It Works

After sending a test email, go to Transactional emailsLogs in the Sender dashboard. The Latest events log page displays each sent message with its Event status, Recipient, Subject, Template, and Date / time. A delivered email appears as a logged event with the correct recipient and subject. You can also filter by Event type, Domain, or Campaign to locate your test message.

Common Issues

Authentication failed (API) → The API token is missing, expired, or incorrectly formatted. Verify the Authorization: Bearer header includes a valid token from Account settingsAPI access tokens. Ensure there are no extra spaces or line breaks in the token value.

SMTP connection refused → Your hosting provider may block port 25 or 587. Try connecting on port 2525 instead. Confirm that smtp.sender.net is reachable from your server and that TLS is enabled.

Emails not appearing in Logs → The request may not have reached Sender. For API, check the HTTP response code — a non-2xx response means the request was rejected. For SMTP, review your application’s mail logs for connection or authentication errors.

“From” address rejected → The sender email address is not verified in your Sender account. Go to Account settingsDomains and verify the domain or specific sender address before sending.

FAQs

Should I use REST API or SMTP to send transactional emails?

REST API is recommended for most integrations — it provides structured JSON responses, easier debugging, and more control over request parameters. Use SMTP when your application or CMS only supports SMTP-based email configuration.

Can I use both API and SMTP in the same account?

Yes. API and SMTP are independent sending methods that share the same Sender account. You can configure one application to send via API and another via SMTP without conflict.

Which SMTP port should I use?

Port 587 with TLS is recommended. If your hosting provider blocks 587, use port 2525 as an alternative. Port 25 is also supported but is commonly blocked by cloud providers and ISPs.

Can I use multiple sender addresses for transactional emails?

Yes. Configure the from field in your API request or the “From” header in your SMTP settings to use different verified sender addresses depending on the email type.

Where do I find my SMTP username and password?

Go to Transactional emailsSetup instructions, select the SMTP tab, and click Add SMTP user. Your credentials are generated and displayed on this page.