Python newbie needs help connecting to mail server

software development

#1

I don’t remember the last time I posted here.

Anyway, I’m starting to learn Python and I’m writing a script that runs on my computer, but it uses my Dreamhost SMTP server (mail.mydomain.com). So far, the Dreamhost server is rejecting my script’s attempts. I’m getting messages that says:

reply: '554 <user@receiver.com>: Recipient address rejected: Relay access denie
d\r\n’
reply: retcode (554); Msg: <user@receiver.com>: Recipient address rejected: Rel
ay access denied
send: 'rset\r\n’
reply: '250 Ok\r\n’
reply: retcode (250); Msg: Ok
Traceback (most recent call last):
File “./ip.py”, line 55, in ?
server.sendmail(fromaddr, toaddrs, msg)
File “/usr/lib/python2.2/smtplib.py”, line 650, in sendmail
raise SMTPRecipientsRefused(senderrs)
smtplib.SMTPRecipientsRefused: {‘User <user@receiver.com>’: (554, ‘<user@receiver.com>: Recipient address rejected: Relay access denied’)}

Any insight as to what exactly this means would be nice, thanks.

Alex
http://www.gerbilbox.org/


#2

I don’t think that’s the error code we’d give - generally you’d get a 550 if relay access were denied. I’m pretty sure you’d generally get a 554 error if your IP was blocked (there would be a different error message though).

In any event, you would have to use SMTP authentication to send mail through our SMTP servers, since the script on your computer is (presumably) connecting from outside of our networks. I imagine it’s not too hard to write the script so that it will generate the proper authentication data, but it’s most likely going to be easier to use your ISP’s SMTP server.