---
title: SureMail and EmailIT
date: 2026-02-26T18:16:10Z
modified: 2026-02-27T17:52:50Z
permalink: "https://techarticles.co.uk/suremail-and-emailit/"
type: post
status: publish
excerpt: ""
wpid: 6003
categories:
  - Blog
  - Coding
  - SureMail
  - Wordpress
timestamp: 2026-02-27T17:52:50Z
tags:
  - Blog
  - Coding
  - SureMail
  - Wordpress
---

I raised a ticket for this one a little while ago and have got more and more concerned as time moves on, and as of today, I still haven’t seen a changelog entry to cover this change within Suremail, but Emailit is sunsetting their V1 API in just 2 days (end of Feb) I don’t have enough details on what will happen here i.e will they put a forwarder in place.

![emailit api sunsetting](https://techarticles.co.uk/wp-content/uploads/2026/02/emailit-api-sunsetting-1.png)

I am ok, I have Notify for suremail installed on every single site I have SureMail on, and it will tell me if delivery fails because of this, but I wanted to be ready, as far as I can tell in testing, the change is simply a case of changing the endpoint v1 —> v2 but I can’t sub class this as its a private but thankfully its a http request so we can swap it out.

So I have done some further testing this evening and have decided this seems to work great, and have prepared a patch I can deploy to my sites as needed to prevent any further issues in testing. It works; the error logs perfectly prove interception is happening, and the emails are being delivered.

<?php
/**
 * Force SureMails Emailit endpoint to v2.
 */

add_filter('pre_http_request', function ($preempt, $args, $url) {

    // Change this to the URL you want to replace.
    $old = 'https://api.emailit.com/v1/emails';
    $new = 'https://api.emailit.com/v2/emails';

    // Only swap when it matches exactly (or use strpos if needed).
    if ($url !== $old) {
        return $preempt; // let WP handle everything else normally
    }

    // Prevent infinite recursion when we call wp_safe_remote_post() below.
    static $in_progress = false;
    if ($in_progress) {
        return $preempt;
    }
    $in_progress = true;
    
    
    // Optional Log interception
    //error_log('[SureMails Emailit Override] Intercepted request: ' . $url);
    //error_log('[SureMails Emailit Override] Redirecting to: ' . $new);


    // Perform the request to the new endpoint with the same args.
    $response = wp_safe_remote_request($new, $args);

    $in_progress = false;

    // Returning a response array here short-circuits the original request.
    return $response;

}, 10, 3);```
<span class="line"><span style="color: #F97583"><?</span><span style="color: #E1E4E8">php</span></span>
<span class="line"><span style="color: #6A737D">/**</span></span>
<span class="line"><span style="color: #6A737D"> * Force SureMails Emailit endpoint to v2.</span></span>
<span class="line"><span style="color: #6A737D"> */</span></span>
<span class="line"></span>
<span class="line"><span style="color: #B392F0">add_filter</span><span style="color: #E1E4E8">(</span><span style="color: #9ECBFF">'pre_http_request'</span><span style="color: #E1E4E8">, </span><span style="color: #F97583">function</span><span style="color: #E1E4E8"> (</span><span style="color: #FFAB70">$preempt</span><span style="color: #E1E4E8">, </span><span style="color: #FFAB70">$args</span><span style="color: #E1E4E8">, </span><span style="color: #FFAB70">$url</span><span style="color: #E1E4E8">) {</span></span>
<span class="line"></span>
<span class="line"><span style="color: #E1E4E8">    </span><span style="color: #6A737D">// Change this to the URL you want to replace.</span></span>
<span class="line"><span style="color: #E1E4E8">    $old </span><span style="color: #F97583">=</span><span style="color: #E1E4E8"> </span><span style="color: #9ECBFF">'https://api.emailit.com/v1/emails'</span><span style="color: #E1E4E8">;</span></span>
<span class="line"><span style="color: #E1E4E8">    $new </span><span style="color: #F97583">=</span><span style="color: #E1E4E8"> </span><span style="color: #9ECBFF">'https://api.emailit.com/v2/emails'</span><span style="color: #E1E4E8">;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #E1E4E8">    </span><span style="color: #6A737D">// Only swap when it matches exactly (or use strpos if needed).</span></span>
<span class="line"><span style="color: #E1E4E8">    </span><span style="color: #F97583">if</span><span style="color: #E1E4E8"> ($url </span><span style="color: #F97583">!==</span><span style="color: #E1E4E8"> $old) {</span></span>
<span class="line"><span style="color: #E1E4E8">        </span><span style="color: #F97583">return</span><span style="color: #E1E4E8"> $preempt; </span><span style="color: #6A737D">// let WP handle everything else normally</span></span>
<span class="line"><span style="color: #E1E4E8">    }</span></span>
<span class="line"></span>
<span class="line"><span style="color: #E1E4E8">    </span><span style="color: #6A737D">// Prevent infinite recursion when we call wp_safe_remote_post() below.</span></span>
<span class="line"><span style="color: #E1E4E8">    static $in_progress </span><span style="color: #F97583">=</span><span style="color: #E1E4E8"> </span><span style="color: #79B8FF">false</span><span style="color: #E1E4E8">;</span></span>
<span class="line"><span style="color: #E1E4E8">    </span><span style="color: #F97583">if</span><span style="color: #E1E4E8"> ($in_progress) {</span></span>
<span class="line"><span style="color: #E1E4E8">        </span><span style="color: #F97583">return</span><span style="color: #E1E4E8"> $preempt;</span></span>
<span class="line"><span style="color: #E1E4E8">    }</span></span>
<span class="line"><span style="color: #E1E4E8">    $in_progress </span><span style="color: #F97583">=</span><span style="color: #E1E4E8"> </span><span style="color: #79B8FF">true</span><span style="color: #E1E4E8">;</span></span>
<span class="line"><span style="color: #E1E4E8">    </span></span>
<span class="line"><span style="color: #E1E4E8">    </span></span>
<span class="line"><span style="color: #E1E4E8">    </span><span style="color: #6A737D">// Optional Log interception</span></span>
<span class="line"><span style="color: #E1E4E8">    </span><span style="color: #6A737D">//error_log('[SureMails Emailit Override] Intercepted request: ' . $url);</span></span>
<span class="line"><span style="color: #E1E4E8">    </span><span style="color: #6A737D">//error_log('[SureMails Emailit Override] Redirecting to: ' . $new);</span></span>
<span class="line"></span>
<span class="line"></span>
<span class="line"><span style="color: #E1E4E8">    </span><span style="color: #6A737D">// Perform the request to the new endpoint with the same args.</span></span>
<span class="line"><span style="color: #E1E4E8">    $response </span><span style="color: #F97583">=</span><span style="color: #E1E4E8"> </span><span style="color: #B392F0">wp_safe_remote_request</span><span style="color: #E1E4E8">($new, $args);</span></span>
<span class="line"></span>
<span class="line"><span style="color: #E1E4E8">    $in_progress </span><span style="color: #F97583">=</span><span style="color: #E1E4E8"> </span><span style="color: #79B8FF">false</span><span style="color: #E1E4E8">;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #E1E4E8">    </span><span style="color: #6A737D">// Returning a response array here short-circuits the original request.</span></span>
<span class="line"><span style="color: #E1E4E8">    </span><span style="color: #F97583">return</span><span style="color: #E1E4E8"> $response;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #E1E4E8">}, </span><span style="color: #79B8FF">10</span><span style="color: #E1E4E8">, </span><span style="color: #79B8FF">3</span><span style="color: #E1E4E8">);</span></span>
```JavaScript

![emailit debug log proof of concept](https://techarticles.co.uk/wp-content/uploads/2026/02/emailit-debug-log-proof-of-concept.png)

This patch if nessary means I am prepared even if SureMail hasn’t updated before the sunsets of V1, I can use my deploy script and emergency updates to get this on every site within about 10 minutes of becoming aware on Saturday.

**Update: 27th Feb 2026**

I got an email to say an update has been released this morning, and this includes the API changes for Emailit