我正在制作一个发送电子邮件的程序。它已成功发送,但每当我查看我的电子邮件时,它都存储在垃圾邮件而不是收件箱中。出现这种情况的原因是什么?
public static void send() {
String to = "[email protected]";
String from = "[email protected]";
String host = "localhost";
String msgbody ="Please Click the Link:\n";
String linktest = "http://localhost:50000/first_ecom/VerifiedSuccessfuly.risc?ccstyle=defaultrisc";
Properties properties = System.getProperties();
properties.setProperty("mail.smtp.host", host);
Session session = Session.getDefaultInstance(properties);
try{
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(from));
message.addRecipient(Message.RecipientType.TO,new InternetAddress(to));
message.setSubject("Verify your Account.");
message.setText(msgbody+linktest);
Transport.send(message);
System.out.println("Sent");
}catch (MessagingException mex) {mex.printStackTrace();}
}
因为它是一种垃圾邮件。您的电子邮件from
字段说它是从[email protected]
发送的,但您没有使用Gmail和相同的地址发送此电子邮件。这就像你使用假身份发送电子邮件。所以你的传入邮件服务器partnersolutions.com.ph
认为它是垃圾邮件。
你的IP不安全吗?
请更换另一项服务。