【发布时间】:2017-09-02 00:32:33
【问题描述】:
我正在使用 Mailgun 发送交易电子邮件(事件票),所有电子邮件都发送到 Outlook/Hotmail 垃圾邮件,我想避免这种情况。我添加了 SPF 和 DKIM 记录,但没有任何效果。我应该怎么做才能避免垃圾邮件过滤器(实际上,我不是在发送垃圾邮件。用户在注册事件时触发交易电子邮件)
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", "<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" );
}
【问题讨论】:
标签: java email outlook mailgun