Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to avoid Spam in Outlook/Hotmail with Mailgun?

I'm using Mailgun to send transactional emails (tickets for events) and all the emails are sent to Outlook/Hotmail spam and I want to avoid that. I have added the SPF and DKIM records and nothing works. What should I do to avoid the spam filter (actually, I'm not sending spam. The user triggers the transactional email when he register to an event)

Client client = Client.create ();
client.addFilter ( new HTTPBasicAuthFilter ( "api", "MI_API_KEY" ) );
WebResource webResource = client
        .resource ( "MAILGUN_URL" );

MultivaluedMapImpl formData = new MultivaluedMapImpl();

formData.add ( "from", "[email protected]" );
formData.add ( "to", "[email protected]" );
formData.add ( "subject", "Camilo, welcome to the event" );
formData.add ( "html", "<h1>Camilo thank you for your registration in the event</h1>") );
formData.add ( "text", "Camilo thank you for your registration in the event" );

ClientResponse clientResponse = webResource.type ( MediaType.APPLICATION_FORM_URLENCODED )
        .post ( ClientResponse.class, formData );

int status = clientResponse.getStatus ();

if ( status >= 400 )
{
    throw new BadRequestException ( "Your message couldn't be sent" );
}
like image 513
Camilo Sacanamboy Avatar asked Apr 06 '17 19:04

Camilo Sacanamboy


1 Answers

Your issue isn't your code, it a problem with using MailGun. If you check the email headers with the following site:

https://testconnectivity.microsoft.com/?tabid=mha

You'll see something similar to the following:

Spam Confidence Level   5 (Spam Confidence Interpretation - Spam)

Bulk Complaint Level    6 (Bulk Complaint Level - The message is from a bulk sender that generates a mixed number of complaints.)

The issue is that MS view anything from a shared MG IP as coming from a bulk sender, this impacts SPL and can raise it to 5 or above (spam).

How do I know this? I'm having the exact same issue. I think the only option will be to go for a private IP, but our sending volume is not high enough, so it looks like we've wasted a lot of time and effort on MG!

Does anybody know another bulk sender that avoids Hotmail spam?


OK, an update to this just in case it helps anybody. We have finally managed to get delivery to Outlook from MailGun, this is what we checked / corrected etc, hope it helps:

  • From address needs to be [email protected], not [email protected] (seems obvious now, be we missed this
  • Add a h:List-Unsubscribe header and use <%unsubscribe_url%> to substitute the unsubscribe link
  • Check your SPF. When adding the MailGun SPF our provider added an additional invalid SPF record automatically, apparently you can only have one SPF per sub domain
  • Make sure that links in your content link to your domain
  • Make sure that branding is relevant and links to your domain
  • Make sure you have a clear unsubscribe message. We initially just had a text link saying 'unsubscribe", we changed this to "Click here to unsubscribe if you no longer want our emails"

It is definitely worth checking the headers with https://testconnectivity.microsoft.com/?tabid=mha This will give you leverage when getting MG to switch out an IP with poor reputation.

like image 107
InTooDeep Avatar answered Oct 02 '22 11:10

InTooDeep