Python newbie needs help connecting to mail server

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 ( So far, the Dreamhost server is rejecting my script’s attempts. I’m getting messages that says:

reply: '554 <>: Recipient address rejected: Relay access denie
reply: retcode (554); Msg: <>: 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 “./”, line 55, in ?
server.sendmail(fromaddr, toaddrs, msg)
File “/usr/lib/python2.2/”, line 650, in sendmail
raise SMTPRecipientsRefused(senderrs)
smtplib.SMTPRecipientsRefused: {‘User <>’: (554, ‘<>: Recipient address rejected: Relay access denied’)}

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


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.