Mail repeatedly sent by JavaMail ends up in Spam folder

青春壹個敷衍的年華 提交于 2019-12-11 23:45:58

问题


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.


回答1:


What causes this? Your spam filter!

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.




回答2:


Mail goes to spam when Google find any insecure IP or links, Make sure you don't have any other IP which is not authenticated (can be access by https://"IP")




回答3:


If there is overflow emailId then most of the times it goes to spam, It's done by google. But you can still change that protocol by google by below method:

First time you need to go to your spam and open the mail then the cross option would be above the mail (Which means cancel that mail from spam) click on that (mentioned in the screenshot:. From the next time, it would not go to your spam.



来源:https://stackoverflow.com/questions/13953303/mail-repeatedly-sent-by-javamail-ends-up-in-spam-folder

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!