title: How to avoid Spam in Outlook/Hotmail with Mailgun?
body: <p>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)</p>
  
  <pre><code>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", "hola@peewah.co" );
  formData.add ( "to", "csacanam@outlook.com" );
  formData.add ( "subject", "Camilo, welcome to the event" );
  formData.add ( "html", "&lt;h1&gt;Camilo thank you for your registration in the event&lt;/h1&gt;") );
  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 &gt;= 400 )
  {
      throw new BadRequestException ( "Your message couldn't be sent" );
  }
  </code></pre>