【发布时间】:2013-11-22 20:24:03
【问题描述】:
作为批处理作业的一部分,我需要发送群邮件。我正在使用 javax.mail 包来完成此操作。
Properties m_properties;
m_properties = new Properties();
m_properties.put("mail.smtp.host", "localhost");
m_properties.put("mail.smtp.port", Integer.toString(26));
Session m_Session = Session.getDefaultInstance(m_properties);
Message m_simpleMessage = new MimeMessage(m_Session);
InternetAddress m_fromAddress = new InternetAddress("me@sample.com");
InternetAddress m_toAddress = new InternetAddress("group@sample.com");
m_simpleMessage.setFrom(m_fromAddress);
m_simpleMessage.setRecipient(RecipientType.TO, m_toAddress);
m_simpleMessage.setSubject(m_subject);
m_simpleMessage.setContent(m_body, "text/html");
Transport.send(m_simpleMessage);
我正在使用 Windows 服务器。我安装了 IIS SMPT 服务器并使用它。当我向个人 ID 发送邮件时,我没有问题。但是在尝试发送到群组时出现错误。
错误:
这是一个自动生成的交付状态通知。 传递到下列收件人失败。 group@sample.com
我是否需要在我的 SMPT 服务器中为群组配置某些内容,或者我是否需要更改我的代码以允许发送群组邮件。
【问题讨论】:
-
这很可能是 SMTP 服务器的问题。 JavaMail 不知道也不关心电子邮件地址是针对单个用户还是针对分发列表(组)的。
-
我是否需要配置 SMTP 以便它知道组信息。如果是这样,我可以在哪里做。
-
可能想问serverfault.com
标签: java smtp windows-server-2008