Reliable email delivery with minimal setup
Send transactional email from WordPress in minutes with Sidemail and built‑in wp_remote_post. No plugins, SMTP, or Composer required. Sidemail handles deliverability, domain authentication, and email templates so you can send reliably and fast.
// functions.php — reusable Sidemail helper
function sidemail_send_email( $args ) {
$api_key = defined( 'SIDEMAIL_API_KEY' ) ? SIDEMAIL_API_KEY : '';
if ( empty( $api_key ) ) {
return new WP_Error( 'missing_key', 'Sidemail API key is not defined.' );
}
$response = wp_remote_post( 'https://api.sidemail.io/v1/email/send', array(
'headers' => array(
'Authorization' => 'Bearer ' . $api_key,
'Content-Type' => 'application/json',
),
'body' => json_encode( $args ),
'timeout' => 15,
) );
if ( is_wp_error( $response ) ) {
return $response;
}
$body = wp_remote_retrieve_body( $response );
$code = wp_remote_retrieve_response_code( $response );
if ( $code >= 400 ) {
return new WP_Error( 'api_error', 'Sidemail API Error: ' . $body );
}
return json_decode( $body );
}Start sending emails from your WordPress site in three steps:
Add your Sidemail API key to wp-config.php:
// wp-config.php
define( 'SIDEMAIL_API_KEY', 'your-api-key-here' );Add a reusable sidemail_send_email function to your theme's functions.php. It uses WordPress's built‑in wp_remote_post — no plugins or Composer needed.
// functions.php
function sidemail_send_email( $args ) {
$api_key = defined( 'SIDEMAIL_API_KEY' ) ? SIDEMAIL_API_KEY : '';
if ( empty( $api_key ) ) {
return new WP_Error( 'missing_key', 'Sidemail API key is not defined.' );
}
$response = wp_remote_post( 'https://api.sidemail.io/v1/email/send', array(
'headers' => array(
'Authorization' => 'Bearer ' . $api_key,
'Content-Type' => 'application/json',
),
'body' => json_encode( $args ),
'timeout' => 15,
) );
if ( is_wp_error( $response ) ) {
return $response;
}
$body = wp_remote_retrieve_body( $response );
$code = wp_remote_retrieve_response_code( $response );
if ( $code >= 400 ) {
return new WP_Error( 'api_error', 'Sidemail API Error: ' . $body );
}
return json_decode( $body );
}Call sidemail_send_email from any action hook, shortcode, or custom endpoint. Pass the recipient, sender, and template or content. That's all.
// Send welcome email when a new user registers
add_action( 'user_register', function ( $user_id ) {
$user = get_userdata( $user_id );
sidemail_send_email( array(
'toAddress' => $user->user_email,
'fromAddress' => '[email protected]',
'fromName' => 'Your WordPress Site',
'templateName' => 'Welcome',
'templateProps' => array(
'username' => $user->user_login,
),
) );
} );Key features & perks
wp_remote_post.With Sidemail, you can send any transactional email from WordPress. Here are a few examples with code:
// WordPress: Send a WooCommerce order confirmation email
add_action( 'woocommerce_order_status_completed',
function ( $order_id ) {
$order = wc_get_order( $order_id );
sidemail_send_email( array(
'toAddress' => $order->get_billing_email(),
'fromAddress' => '[email protected]',
'fromName' => 'Your Store',
'templateName' => 'Order Confirmation',
'templateProps' => array(
'customerName' => $order->get_billing_first_name(),
'orderNumber' => (string) $order->get_order_number(),
'total' => $order->get_formatted_order_total(),
),
) );
}
);Send a receipt or order confirmation to your WooCommerce customer after a purchase.
templateProps to populate Sidemail's receipt and invoice templates.// WordPress: Send a password reset email
add_filter( 'retrieve_password_message', 'my_custom_password_reset', 10, 4 );
function my_custom_password_reset( $message, $key, $user_login, $user_data ) {
$reset_url = network_site_url(
"wp-login.php?action=rp&key=$key&login=" . rawurlencode( $user_login ),
'login'
);
sidemail_send_email( array(
'toAddress' => $user_data->user_email,
'fromAddress' => '[email protected]',
'fromName' => 'Your WordPress Site',
'templateName' => 'Password Reset',
'templateProps' => array(
'actionUrl' => $reset_url,
'username' => $user_login,
),
) );
return false;
}Replace WordPress's default reset message with a branded password reset email that includes a secure reset link.
retrieve_password_message to replace WordPress's default password reset email with your own branded version.templateProps and return false to stop WordPress from sending its default reset email.// WordPress: Schedule a welcome email for 1 hour from now
$scheduled = gmdate( 'c', time() + 3600 );
sidemail_send_email( array(
'toAddress' => '[email protected]',
'fromAddress' => '[email protected]',
'fromName' => 'Your WordPress Site',
'templateName' => 'Welcome',
'scheduledAt' => $scheduled,
) );Schedule a welcome email to be sent later, for example one hour after registration.
scheduledAt field with an ISO 8601 timestamp to control exactly when the email is sent.// WordPress: Send a contact form submission email
function handle_contact_form_submission() {
// ... validate nonce and fields ...
$email = sanitize_email( $_POST['email'] );
$name = sanitize_text_field( $_POST['name'] );
$message = sanitize_textarea_field( $_POST['message'] );
sidemail_send_email( array(
'toAddress' => '[email protected]',
'fromAddress' => '[email protected]',
'fromName' => 'Contact Form',
'templateName' => 'New Inquiry',
'templateProps' => array(
'replyTo' => $email,
'name' => $name,
'message' => $message,
),
) );
}Send a notification email when someone submits your WordPress contact form, and pass the submitted data straight into your Sidemail template.
templateProps to populate a template like New Inquirywith the visitor's name, email, and message.Deliverability best practices
SPF and DKIM are authentication protocols that verify your emails are legitimately sent from your domain. And DMARC builds on both by instructing mail servers how to handle messages that fail those checks. Together, they are 3 critical factors for inbox delivery and sender reputation.
Sidemail automatically handles SPF, DKIM, and DMARC setup for you, so your WordPress site sends authenticated, best‑practice‑compliant emails right out of the box.




The simplest way to build emails
Sidemail's no‑code email editor is the quickest way to create responsive email templates that render correctly across every client and device. No HTML knowledge needed. Add your logo and brand colors, and you're ready to send.
Need to move faster? Sidemail includes a library of production‑ready templates for the most common use cases – password resets, welcome emails, receipts, and more. Build from scratch or customize a premade template — we guarantee your emails look great everywhere.
Learn moreReady to send transactional emails from your WordPress site? With Sidemail's API and premade templates, you can integrate in minutes and deliver emails reliably — no plugins required.
Start free trialUse Sidemail's email API with WordPress's built‑in wp_remote_post. Store your API key in wp-config.php, add a small helper function to functions.php, and call it from any hook, shortcode, or custom endpoint. No plugins, no Composer, no SMTP configuration needed.
Yes. Instead of using wp_mail() with an SMTP plugin, you call Sidemail's API directly. You get template support, scheduling, delivery tracking, and high deliverability out of the box — features wp_mail() doesn't provide natively.
In the Sidemail dashboard, pick a premade template or build one with the drag‑and‑drop editor. In your code, reference the template by templateName and pass dynamic data via templateProps. Sidemail merges the data and delivers a well‑formatted email. No need to build HTML from PHP.
Absolutely. Hook into WooCommerce actions like woocommerce_order_status_completed or woocommerce_new_order and call sidemail_send_email() with the order data. It works with any WordPress action hook, so any plugin that fires hooks can be integrated.
Yes. Add a scheduledAt parameter with an ISO 8601 timestamp and Sidemail will deliver the email at exactly that time. This is handled server‑side by Sidemail, so you don't need WP-Cron or any task scheduler on your hosting.
Check the response from wp_remote_post using is_wp_error() for transport failures, then inspect the decoded JSON body for Sidemail API errors. The response includes an HTTP status code, error type, and a human-readable message. Log errors using error_log() or a WordPress logging plugin.