[Seasar-user:10568] [S2Mai] SMTPAddressFailedExceptionが発生してしまう
Junichi Kato
[E-MAIL ADDRESS DELETED]
2007年 9月 17日 (月) 15:13:20 JST
加藤です.
たぶん,私の環境が問題だと思うのですが,アドバイスをお願いいたします.
mailProperties.diconは以下のような構成で,
<components namespace="mailProperties">
<include path="config.dicon"/>
<component name="host">
"mail.grandtech.jp"
</component>
<component name="port">
587
</component>
<component name="username">
"[E-MAIL ADDRESS DELETED]"
</component>
<component name="password">
"hogehoge"
</component>
<component name="from">
null
</component>
<component name="replyTo">
null
</component>
<component name="returnPath">
null
</component>
<component name="messageId">
null
</component>
<component name="templateEncoding">
"UTF-8"
</component>
<component name="connectionTimeout">
10000
</component>
<component name="readTimeout">
10000
</component>
<component name="mailCharset">
"ISO-2022-JP"
</component>
</components>
@RunWith(Seasar2.class)
public class ExampleMaiTest {
private ExampleMai registerMai;
@Test
public void testSendMail() {
ExampleMailDto mailData = new ExampleMailDto();
mailData.getTo().add(new MailAddress("[E-MAIL ADDRESS DELETED]"));
mailData.setFrom(new MailAddress("[E-MAIL ADDRESS DELETED]"));
registerMai.sendMail(mailData);
}
}
というテストを実行すると以下のような例外が発生してしまいます.
ExampleMailDtoには,
private MailAddress from;
private List<MailAddress> to = new ArrayList<MailAddress>();
private List<MailAddress> cc = new ArrayList<MailAddress>();;
private List<MailAddress> bcc = new ArrayList<MailAddress>();;
private String subject;
のプロパティがあります.
ExampleMai_sendMail.ftlは,以下の通り.
Subject: test mail
test
ちなみに,当該SMTPサーバは通常のメール用途で利用しており,問題なく送信できます.
SMTP認証は,PLAINと,CRAM-MD5に対応しているサーバです.
mailPropertiesのusernameと,passwordを指定しているのですが,SMTP認証は実行されているのでしょうか?
DEBUG 2007-09-17 14:03:12,849 [main] S2Containerを作成しました。path=mailProperties.dicon
DEBUG 2007-09-17 14:03:13,108 [main] send mail...
DEBUG 2007-09-17 14:03:13,109 [main] Mail
Return-Path: null
From: [E-MAIL ADDRESS DELETED]
To: [E-MAIL ADDRESS DELETED]
Cc: null
Bcc: null
Reply-To: null
Subject: test mail
Subject: test mail
test
2007-09-17 14:03:13,689 [main] ERROR com.ozacc.mail.impl.SendMailImpl - メールの送信に失敗しました。
javax.mail.SendFailedException: Invalid Addresses;
nested exception is:
com.sun.mail.smtp.SMTPAddressFailedException: 553 sorry, that domain isn't in my list of allowed rcpthosts (#5.7.1)
at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1196)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:584)
at com.ozacc.mail.impl.SendMailImpl.processSend(SendMailImpl.java:183)
at com.ozacc.mail.impl.SendMailImpl.send(SendMailImpl.java:129)
at com.ozacc.mail.impl.SendMailImpl.send(SendMailImpl.java:96)
at org.seasar.mai.mail.impl.Invocation.send(Invocation.java:46)
at org.seasar.mai.mail.impl.TransportImpl.send(TransportImpl.java:47)
at org.seasar.mai.interceptors.S2MaiInterceptor.send(S2MaiInterceptor.java:100)
at org.seasar.mai.interceptors.S2MaiInterceptor.sendMail(S2MaiInterceptor.java:80)
at org.seasar.mai.interceptors.S2MaiInterceptor.invoke(S2MaiInterceptor.java:66)
at org.example.web.mai.ExampleMai$$EnhancedByS2AOP$$1e1ee5d$$MethodInvocation$$sendMail0.proceed(MethodInvocationClassGenerator.java)
at org.seasar.framework.aop.interceptors.TraceInterceptor.invoke(TraceInterceptor.java:73)
at org.example.web.mai.ExampleMai$$EnhancedByS2AOP$$1e1ee5d$$MethodInvocation$$sendMail0.proceed(MethodInvocationClassGenerator.java)
at org.example.web.mai.ExampleMai$$EnhancedByS2AOP$$1e1ee5d.sendMail(ExampleMai$$EnhancedByS2AOP$$1e1ee5d.java)
at org.example.web.mai.ExampleMaiTest.testSendMail(ExampleMaiTest.java:21)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.seasar.framework.unit.S2TestMethodRunner.executeMethodBody(S2TestMethodRunner.java:673)
at org.seasar.framework.unit.S2TestMethodRunner.executeMethod(S2TestMethodRunner.java:648)
at org.seasar.framework.unit.S2TestMethodRunner.runTest(S2TestMethodRunner.java:614)
at org.seasar.framework.unit.S2TestMethodRunner.runMethod(S2TestMethodRunner.java:253)
at org.seasar.framework.unit.S2TestMethodRunner.run(S2TestMethodRunner.java:171)
at org.seasar.framework.unit.S2TestClassMethodsRunner.invokeTestMethod(S2TestClassMethodsRunner.java:227)
at org.seasar.framework.unit.S2TestClassMethodsRunner.run(S2TestClassMethodsRunner.java:89)
at org.seasar.framework.unit.S2TestClassRunner.run(S2TestClassRunner.java:47)
at org.seasar.framework.unit.Seasar2.run(Seasar2.java:168)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: com.sun.mail.smtp.SMTPAddressFailedException: 553 sorry, that domain isn't in my list of allowed rcpthosts (#5.7.1)
at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1047)
... 33 more
DEBUG 2007-09-17 14:03:13,719 [main] END org.example.web.mai.ExampleMai#sendMail([E-MAIL ADDRESS DELETED]) Throwable:com.ozacc.mail.MailSendException: メールの送信に失敗しました。
DEBUG 2007-09-17 14:03:13,731 [main] トランザクションをロールバックしました。tx={0}
DEBUG 2007-09-17 14:03:13,754 [main] 環境変数#Envにファイル(env.txt)から値(ct)が設定されました
───────────────────────────────
株式会社 グランテック
代表取締役社長
加藤 潤一 Junichi Kato
〒154-0012
東京都世田谷区駒沢2-16-1 サンドー駒沢ビル4F
TEL 050-5538-2383 FAX 03-3487-7211
HP : http://www.grandtech.jp/
BLOG : http://d.hatena.ne.jp/j5ik2o/
E-MAIL : [E-MAIL ADDRESS DELETED]
Seasar-user メーリングリストの案内