JavaMail反复发送的邮件最终位于“垃圾邮件"文件夹中 [英] Mail repeatedly sent by JavaMail ends up in Spam folder

查看:412
本文介绍了JavaMail反复发送的邮件最终位于“垃圾邮件"文件夹中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用JavaMail从JSP页面内部发送邮件,如下所示:

I'm sending a mail using JavaMail from inside a JSP page as follows:

String from= request.getParameter("from");
String to= request.getParameter("to");
String thanks= request.getParameter("thanks");
String subject= request.getParameter("subject");

try{
    SmtpClient client = new SmtpClient("smtp.example.com");
    client.from(from);
    client.to(to);
    PrintStream message = client.startMessage();
    message.println("From: " + from);
    message.println("To: " + to);
    message.println("Subject: " + subject);
    message.println();
    Enumeration paramNames = request.getParameterNames();

    while(paramNames.hasMoreElements()) {
        String paramName = (String) paramNames.nextElement();
        String paramValue = request.getParameter(paramName);

        if (request.getParameter(paramName) != null && 
            request.getParameter(paramName) != "") {
            message.println(paramName + ": " + paramValue);
            message.println();
        }
    }

    client.closeServer();
}
catch (IOException e){    
    System.out.println("ERROR IN DELIVERING THE FORM:"+e);
}

这首先工作得很好,然后将数据发送到了我的收件箱,但经过多次试验和微不足道的更改,现在该帖子转到了我的垃圾邮件"文件夹.

This was working fine first and sent the data to my Inbox, but after many trials and insignificant changes, now the post goes to my Spam folder.

我很高兴有人能告诉我问题出在哪里以及什么原因造成的.

I appreciate if anyone could tell me where the problem is and what causes this.

推荐答案

是什么原因造成的?您的垃圾邮件过滤器!

What causes this? Your spam filter!

根据您/您的邮件提供商用作垃圾邮件过滤器的方式,您可能会从邮件标题中学到一些东西-我记得spamassassin提供了有关哪个过滤器得分高以及垃圾邮件得分的一些信息.其他人也可以这样做.

Depending on what you/your mail provider uses as spam filter, you might learn something from the mail headers - I recall spamassassin giving some information about what filter scored how high, and the resulting spam score. Others might do that as well.

如果您从垃圾邮件文件夹中删除该邮件,您也许还可以训练其垃圾邮件过滤器以将该邮件识别为非垃圾邮件(火腿).

You might also be able to train your spam filter to recognize this mail as non-spam (ham) if you remove it from the spamfolder.

这篇关于JavaMail反复发送的邮件最终位于“垃圾邮件"文件夹中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆