Lotus サーバーでいくつかの問題に直面しています。サーバーを担当している担当者は、構成は問題ないと言っていますが、彼の Lotus サーバーで HTML 本文のメールを送信できません。
表示されるエラーは次のとおりです:「ポリシー上の理由により、554 リレーが拒否されました。」</p>
自分の PC で試してみたところ、smpt.gmail.com を使用してチャンピオンのように動作しました。したがって、コードの問題ではなく、問題はサーバーの構成にあると思います。
javaMail と Lotus に問題はありますか? それは共通の問題ですか?(あるブログで、HTML を送信することはできないと言っている人がいましたが、私はそれを信じることができません)
念のため私のコード、
public void sendEmail(String toEmailAddr, String subject, String issue) {
Properties props = new Properties();
props.put("mail.smtp.host", host);
props.put("mail.smtp.port", port);
Session mailSession = Session.getDefaultInstance(props);
Message simpleMessage = new MimeMessage(mailSession);
InternetAddress toAddress = null;
InternetAddress toAddress2[] = null;
Transport t = null ;
try {
Multipart mp = new MimeMultipart();
MimeBodyPart htmlPart = new MimeBodyPart();
htmlPart.setContent(issue, "text/html");
mp.addBodyPart(htmlPart);
simpleMessage.setContent(mp);
} catch (MessagingException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try {
toAddress = new InternetAddress(toEmailAddr);
toAddress2 = new InternetAddress [1];
toAddress2[0] = toAddress;
} catch (AddressException e) {
// TODO LOG
e.printStackTrace();
}
try {
simpleMessage.setRecipients(RecipientType.TO, toAddress2);
simpleMessage.setSubject(subject);
t = mailSession.getTransport("smtp");
if(userPwd==null)
userPwd = "";
t.connect(host, userName, userPwd);
t.sendMessage(simpleMessage, simpleMessage.getAllRecipients());
} catch (MessagingException e) {
e.printStackTrace();
// TODO LOG
}finally{
try {
t.close();
} catch (MessagingException e) {
// TODO LOG
}
}
}
よろしく。