smtplib.SMTPDataError: (503, 'Error: need RCPT command')
Richard van de Stadt
stadt at cs.utwente.nl
Tue Oct 23 00:36:56 EDT 2001
Hi,
This is the first time I've been using the stuff below with Python 2.1.1 running
on Solaris 5.8. I never got the error below before. It runs fine on Linux with
Python 1.5.2, and has been running fine for years on a Solaris 5.6 system, with
Python 1.5.2, 2.1 and 2.1.1. Could the error below be caused by Solaris 5.8's
version of sendmail?
Could anyone explain what this RCPT command is that seems to be needed?
---------------------
mail.sendmail(fromaddr, recipients, message % locals())
File "/usr/local/pkg/Python-2.1.1/lib/python2.1/smtplib.py", line 496, in sendmail
(code,resp) = self.data(msg)
File "/usr/local/pkg/Python-2.1.1/lib/python2.1/smtplib.py", line 386, in data
raise SMTPDataError(code,repl)
smtplib.SMTPDataError: (503, 'Error: need RCPT command')
---------------------
Here's a part of my send_email function:
...
fromstring = '...'
fromaddr = maintaineremail
cc_list = string.join ((chairemail, maintaineremail), ', ')
date = ctime(time())
dayName = date[:3] + ','
monthName = date[3:7]
day = date[7:10]
year = date[19:]
Time = date[10:19]
timeZone = ' ' + tzname[daylight]
date = dayName + day + monthName + year + Time + timeZone
message = """\
Subject: %(subject)s
Date: %(date)s
From: %(fromstring)s <%(fromaddr)s>
Reply-To: %(fromaddr)s
To: %(to_list)s
Cc: %(cc_list)s
X-Mailer: Python smtplib
%(body)s
"""
try:
mail = smtplib.SMTP(LocalMailServer)
except:
mail = smtplib.SMTP(altLocalMailServer)
mail.sendmail(fromaddr, recipients, message % locals())
mail.quit()
----------------------------------
Thanks for your help,
Richard.
More information about the Python-list
mailing list