smtplib.SMTPDataError: (503, 'Error: need RCPT command') 
Author Message
 smtplib.SMTPDataError: (503, 'Error: need RCPT command')

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.



Sat, 10 Apr 2004 12:36:56 GMT  
 smtplib.SMTPDataError: (503, 'Error: need RCPT command')


Quote:
> 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()

You appear to have overlooked setting a value for the "to_list" local
variable, and I don't see anything setting "recipients" either. It's
possible you simply omitted to include this section of your code, but an
empty recipient list might result in that error. smtplib line 386 raises an
error because the server doesn't give the expected reply when the client
starts to send the message body.

To check this, try adding

    mail.set_debuglevel(1)

before the .sendmail() call, which will give you a trace of client/server
interactions.

regards
 Steve
--
http://www.holdenweb.com/



Sat, 10 Apr 2004 12:58:03 GMT  
 smtplib.SMTPDataError: (503, 'Error: need RCPT command')



<snip>

Quote:

> Could anyone explain what this RCPT command is that seems to be needed?

Start with http://www.ietf.org/rfc/rfc821.txt

            RCPT <SP> TO:<forward-path> <CRLF>

         This command gives a forward-path identifying one recipient.
         If accepted, the receiver-SMTP returns a 250 OK reply, and
         stores the forward-path.  If the recipient is unknown the
         receiver-SMTP returns a 550 Failure reply.

Other related RFC's include 1869, 1893, 1894 and 2034.

--

Emile van Sebille

---------



Sat, 10 Apr 2004 20:24:20 GMT  
 smtplib.SMTPDataError: (503, 'Error: need RCPT command')

Quote:

>     try:
>         mail = smtplib.SMTP(LocalMailServer)
>     except:
>         mail = smtplib.SMTP(altLocalMailServer)
>     mail.sendmail(fromaddr, recipients, message % locals())

[...]

Quote:
> smtplib line 386 raises an
> error because the server doesn't give the expected reply when the client
> starts to send the message body.

> To check this, try adding

>     mail.set_debuglevel(1)

> before the .sendmail() call, which will give you a trace of client/server
> interactions.

That hint helped.

Turns out the machine I was running this on doesn't have an smtp server.
Therefore smtplib.SMTP('localhost') didn't work out and raised an
exception, after which the altLocalMailServer was tried, which didn't
accept the request from this system (which is correct behavior :-)

Thanks a lot.

Richard.



Sun, 11 Apr 2004 00:51:12 GMT  
 smtplib.SMTPDataError: (503, 'Error: need RCPT command')

    EvS> Start with http://www.ietf.org/rfc/rfc821.txt

Better make that RFC 2821!  And note that RFC 2822 is also the latest
revision of that seminal standard.

http://www.faqs.org/rfcs/rfc2821.html
http://www.faqs.org/rfcs/rfc2822.html

-Barry



Sun, 11 Apr 2004 11:01:09 GMT  
 smtplib.SMTPDataError: (503, 'Error: need RCPT command')
Yes. thanks for the pointer.

I thought rfc821 would give a good perspective on the OPs question of what
RCPT means, and to quote from http://www.faqs.org/rfcs/rfc2821.html , even
though it obsoletes 821, it seems that :
   This document is a self-contained specification of the basic protocol
   for the Internet electronic mail transport.  It consolidates, updates
   and clarifies, but doesn't add new or change existing functionality
   of the following:

   -  the original SMTP (Simple Mail Transfer Protocol) specification of
      RFC 821 [30],

Which begs the question: Does anyone know where there might be a source that
shows the current status or otherwise forward points on older rfc's to the
rfc's that obsolete them?

Emile van Sebille

---------

Quote:
----- Original Message -----

Newsgroups: comp.lang.python
Sent: Tuesday, October 23, 2001 8:01 PM
Subject: Re: smtplib.SMTPDataError: (503, 'Error: need RCPT command')


>     EvS> Start with http://www.ietf.org/rfc/rfc821.txt

> Better make that RFC 2821!  And note that RFC 2822 is also the latest
> revision of that seminal standard.

> http://www.faqs.org/rfcs/rfc2821.html
> http://www.faqs.org/rfcs/rfc2822.html

> -Barry



Sun, 11 Apr 2004 11:46:24 GMT  
 smtplib.SMTPDataError: (503, 'Error: need RCPT command')

Quote:

> Which begs the question: Does anyone know where there might be a source that
> shows the current status or otherwise forward points on older rfc's to the
> rfc's that obsolete them?

   http://RFC.net/rfc-index.html

Exmple:

   0822 Standard for the format of ARPA Internet text messages. D.
      Crocker. Aug-13-1982. (Format: TXT=109200 bytes) (Obsoletes RFC0733)
      (Obsoleted by RFC2822) (Updated by RFC1123, RFC1138, RFC1148,
      RFC1327, RFC2156) (Also STD0011) (Status: STANDARD)

Oleg.
--

           Programmers don't die, they just GOSUB without RETURN.



Sun, 11 Apr 2004 15:31:44 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. TCP/IP error 503 in CW5=ok in CW5.5b the error

2. strange error message with 'load' command

3. Error: needed type 'unsigned'

4. smtplib and passwd's

5. handling errors from spawn'ed commands in Expect

6. globalW'ocx' runtime error'339

7. Need help with use of `exec' command

8. 'CHAIN' command under WIN95

9. Substitute for VB command LoadImage('filename')

10. 'COPY TO' command

 

 
Powered by phpBB® Forum Software