[Tutor] smtp error from cgi script

Ewald Ertl ewald.ertl at hartter.com
Thu Aug 3 09:14:18 CEST 2006


Hi Rob,

Rob wrote:
> Hi, can someone help me interpret the error output below?
>  
> I can't tell whether this is a coding error, or a configuration error,
> in which case, it would be up to my host provider.
>  
> For privacy reasons, I have changed the actual email addresses to
> name at domain1.net <mailto:name at domain1.net> and name at domain2.net
> <mailto:name at domain2.net>.  The first was the recipient and the second
> was the sender.
>  
> Thanks in advance.
> -- Rob
>  
>  
> SMTPRecipientsRefused
> Python 2.3.5: /usr/bin/python
> Wed Aug 2 20:17:33 2006
>  
> A problem occurred in a Python script. Here is the sequence of function
> calls leading up to the error, in the order they occurred.
>  
>  
>    62 
>    63     server = smtplib.SMTP(mailserver)
>    64     failed = server.sendmail(From, To, text)
>    65     server.quit() 
>    66     if failed:
> failed undefined, server = <smtplib.SMTP instance>, server.sendmail =
> <bound method SMTP.sendmail of <smtplib.SMTP instance>>, From =
> 'name at domain2.net' <mailto:'name at domain2.net'>,
> To = 'name at domain1.net' <mailto:'name at domain1.net'>, text = 'From:
> name at domain2.net\nTo <mailto:name at domain2.net\nTo>: name at domain1.net\nDa
> <mailto:name at domain1.net\nDa>... 1 1
> \n----------------------------------------\n'
>  
>  
> /usr/lib/python2.3/smtplib.py
>  in sendmail(self=<smtplib.SMTP instance>, from_addr='name at domain2.net'
> <mailto:from_addr='name at domain2.net'>, to_addrs=['name at domain1.net'],
> msg='From: name at domain2.net\nTo <mailto:name at domain2.net\nTo>:
> name at domain1.net\nDa <mailto:name at domain1.net\nDa>...
> 1 1 \n----------------------------------------\n', mail_options=[],
> rcpt_options=[])
>   685             # the server refused all our recipients
>   686             self.rset()
>   687             raise SMTPRecipientsRefused(senderrs)
>   688         (code,resp) = self.data(msg)
>   689         if code != 250:
> global SMTPRecipientsRefused = <class smtplib.SMTPRecipientsRefused>,
> senderrs = {'name at domain1.net' <mailto:{'name at domain1.net'>: (550,
> 'authentication required')}
>  
> SMTPRecipientsRefused: {'name at domain1.net' <mailto:{'name at domain1.net'>:
> (550, 'authentication required')}
>       args = ({'name at domain1.net' <mailto:{'name at domain1.net'>: (550,
> 'authentication required')},)
>       recipients = {'name at domain1.net' <mailto:{'name at domain1.net'>:
> (550, 'authentication required')}
> 

I've not worked with smtplib, but the error (550, 'authentication required'), suggests
to me, that you have to login into the mail-Server, otherwise the server would not
accept emails.
Looking into the doc for smtplib, the Class SMTP has method for that:

login(self, user, password)
    Log in on an SMTP server that requires authentication.

    The arguments are:
        - user:     The user name to authenticate with.
        - password: The password for the authentication.

    If there has been no previous EHLO or HELO command this session, this
    method tries ESMTP EHLO first.

    This method will return normally if the authentication was successful.

    This method may raise the following exceptions:

     SMTPHeloError            The server didn't reply properly to
                              the helo greeting.
     SMTPAuthenticationError  The server didn't accept the username/
                              password combination.
     SMTPException            No suitable authentication method was
                              found.


HTH Ewald



More information about the Tutor mailing list