会社のSMTPサーバーを介してメールを送信する簡単なPythonスクリプトを作成しようとしています。次のコードを使用しています。
#! /usr/local/bin/python
import sys,re,os,datetime
from smtplib import SMTP
#Email function
def sendEmail(message):
sender="SENDERID@COMPANY.com"
receivers=['REVEIVER1@COMPANY.com','RECEIVER2@COMPANY.com']
subject="Daily Report - " + datetime.datetime.now().strftime("%d %b %y")
header="""\
From: %s
To: %s
Subject: %s
%s""" % (sender, ", ".join(receivers), subject, message)
smtp = SMTP()
smtp.set_debuglevel(1)
smtp.connect('X.X.X.X')
smtp.ehlo()
smtp.starttls()
smtp.ehlo()
try:
smtp.login('SENDERID@COMPANY.com', '********')
smtp.sendmail(sender,receivers,header)
smtp.quit()
except Exception, e:
print e
#MAIN
sendEmail("HAHHAHAHAHAH!!!")
このプログラムを実行すると、この結果が得られます。
connect: ('X.X.X.X', 25)
connect: ('X.X.X.X', 25)
reply: '220 COMPANY.com [ESMTP Server] service ready;ESMTP Server; 05/25/11 15:59:27\r\n'
reply: retcode (220); Msg: COMPANY.com [ESMTP Server] service ready;ESMTP Server; 05/25/11 15:59:27
connect: COMPANY.com [ESMTP Server] service ready;ESMTP Server; 05/25/11 15:59:27
send: 'ehlo SERVER1.COMPANY.com\r\n'
reply: '250-COMPANY.com\r\n'
reply: '250-SIZE 15728640\r\n'
reply: '250-8BITMIME\r\n'
reply: '250 STARTTLS\r\n'
reply: retcode (250); Msg: COMPANY.com
SIZE 15728640
8BITMIME
STARTTLS
send: 'STARTTLS\r\n'
reply: '220 Ready to start TLS\r\n'
reply: retcode (220); Msg: Ready to start TLS
send: 'ehlo SERVER2.COMPANY.com\r\n'
reply: '250-COMPANY.com\r\n'
reply: '250-SIZE 15728640\r\n'
reply: '250 8BITMIME\r\n'
reply: retcode (250); Msg: COMPANY.com
SIZE 15728640
8BITMIME
send: 'quit\r\n'
reply: '221 [ESMTP Server] service closing transmission channel\r\n'
reply: retcode (221); Msg: [ESMTP Server] service closing transmission channel
ERROR: Could not send email! Check the reason below.
SMTP AUTH extension not supported by server.
この「サーバーでサポートされていないSMTPAUTH拡張機能」のデバッグを開始するにはどうすればよいですか。エラー?
PS:正確な詳細を備えたJavaクラスが機能しているので、SMTPの詳細と資格情報が正しいことはわかっています。