- PR -

Java Mail メールサーバに接続できません

1
投稿者投稿内容
トラジャ
ベテラン
会議室デビュー日: 2002/12/05
投稿数: 75
投稿日時: 2004-12-02 22:53
皆さん、またお世話になります。

最近、FreeBSDがらみで苦労しています。

今回は、メールが送信できないトラブルです。

単体プログラムを作ってテストした際の、送信時のログを以下に示しま
す。

"localhost"サーバのSMTPに接続できません。
他のサーバーのSMTPには接続できます。

"localhost"ではPostfixを使っています。(sendmailかも?)
Postfixの設定が何か必要なのでしょうか?

%java SendMail
DEBUG: setDebug: JavaMail version 1.3.1
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth false
DEBUG SMTP: trying to connect to host "localhost", port 25

javax.mail.SendFailedException: Sending failed;
nested exception is:
class javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25;
nested exception is:
java.net.ConnectException: Operation timed out
at javax.mail.Transport.send0(Transport.java:218)
at javax.mail.Transport.send(Transport.java:80)
at SendMail.main(SendMail.java:43)

こちらのログは、他のサーバーに接続してテストしたときのものです。
こちらでは、接続して送信しています。結果は送信先アドレスが不正なため
送信エラーになっていますが、これはサーバーの設定なので、正常動作です。

%java SendMail
DEBUG: setDebug: JavaMail version 1.3.1
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth false
DEBUG SMTP: trying to connect to host "xxx.xxxx.co.jp", port 25

220 xxx.xxxx.co.jp ESMTP Postfix
DEBUG SMTP: connected to host "xxx.xxxx.co.jp", port: 25

EHLO xxxx.xxxxx.co.jp
250-xxx.xxxx.co.jp
250-PIPELINING
250-SIZE 10240000
250-ETRN
250-XVERP
250 8BITMIME
DEBUG SMTP: Found extension "PIPELINING", arg ""
DEBUG SMTP: Found extension "SIZE", arg "10240000"
DEBUG SMTP: Found extension "ETRN", arg ""
DEBUG SMTP: Found extension "XVERP", arg ""
DEBUG SMTP: Found extension "8BITMIME", arg ""
DEBUG SMTP: use8bit false
MAIL FROM:<xxxx@xxxx.xxxxx.co.jp>
250 Ok
RCPT TO:<f-xxx@xxxx.jp>
554 <f-xxx@xxxx.jp>: Recipient address rejected: Relay access denied
DEBUG SMTP: Invalid Addresses
DEBUG SMTP: f-xxx@xxxx.jp
DEBUG SMTP: Sending failed because of invalid destination addresses
RSET
250 Ok
QUIT
javax.mail.SendFailedException: Sending failed;
nested exception is:
class javax.mail.SendFailedException: Invalid Addresses;
nested exception is:
class javax.mail.SendFailedException: 554 <f-xxx@xxxx.jp>: Recipient address rejected: Relay access denied

at javax.mail.Transport.send0(Transport.java:218)
at javax.mail.Transport.send(Transport.java:80)
at SendMail.main(SendMail.java:43)
1

スキルアップ/キャリアアップ(JOB@IT)