gpt4 book ai didi

java - 客户端主机被阻止 - JavaMail

转载 作者:行者123 更新时间:2023-12-02 04:20:48 25 4
gpt4 key购买 nike

我无法通过 JavaMail API 发送邮件这是代码:

package my.eliank.lgg.robots;

import java.time.LocalDateTime;
import java.util.Properties;

import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;

import my.eliank.lgg.MainFrame;

public class MailBot {

private String sender;
private String host;
private Properties properties;
private Session session;

public MailBot() {
sender = "no-reply@baguette.ga";
host = "mx1.freehostingnoads.net";
properties = System.getProperties();
properties.setProperty("mail.smtp.host", host);
properties.setProperty("mail.smtp.port", "2525");
properties.setProperty("mail.smtp.user", "user");
properties.setProperty("mail.smtp.password", "password");
session = Session.getDefaultInstance(properties);
}

public void sendMail(String recipient) {
try {
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(sender));
message.addRecipient(Message.RecipientType.TO, new InternetAddress(recipient));
message.setSubject("Lotto numbers generation @" + LocalDateTime.now().toString().substring(0, 10));
message.setText(MainFrame.textAreaOutput.getText());

Transport.send(message);
System.out.println("Message was successfully sent");
} catch (MessagingException e) {
e.printStackTrace();
}
}

}

问题是每当我尝试通过主机发送邮件时我得到这个异常:

    javax.mail.SendFailedException: Invalid Addresses;
nested exception is:
com.sun.mail.smtp.SMTPAddressFailedException: 554 5.7.1 Service unavailable; Client host [79.177.150.73] blocked using zen.spamhaus.org; http://www.spamhaus.org/query/bl?ip=79.177.150.73

at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1873)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1120)
at javax.mail.Transport.send0(Transport.java:195)
at javax.mail.Transport.send(Transport.java:124)
at my.eliank.lgg.robots.MailBot.sendMail(MailBot.java:41)
at my.eliank.lgg.MainFrame$2.actionPerformed(MainFrame.java:108)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

这个 spamhaus IP 阻止是什么意思以及如何删除它?我正在尝试通过我的主机发送邮件 http://www.freewebhostingnoads.net为什么我总是被屏蔽?

最佳答案

有人使用您的 IP 地址,可能是您的网络托管服务上该 IP 地址的前一个用户,被认为正在发送垃圾邮件。点击错误消息中的链接,它会告诉您该怎么做。如果您使用的是动态 IP 地址,您可能需要切换到静态 IP 地址。

关于java - 客户端主机被阻止 - JavaMail,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32796247/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com