电子邮件已发送,但未在收件箱中发送。它是在垃圾邮件中。为什么会这样?

问题描述 投票:0回答:2

我正在制作一个发送电子邮件的程序。它已成功发送,但每当我查看我的电子邮件时,它都存储在垃圾邮件而不是收件箱中。出现这种情况的原因是什么?

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();}

    }
java email server smtp
2个回答
0
投票

因为它是一种垃圾邮件。您的电子邮件from字段说它是从[email protected]发送的,但您没有使用Gmail和相同的地址发送此电子邮件。这就像你使用假身份发送电子邮件。所以你的传入邮件服务器partnersolutions.com.ph认为它是垃圾邮件。


0
投票

你的IP不安全吗?

请更换另一项服务。

© www.soinside.com 2019 - 2024. All rights reserved.