java mail 垃圾箱,JavaMail反复发送的邮件最终在“垃圾邮件”文件夹中

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!

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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值