If I send mail from the prompt using the mail command sending mail works great. But when I try to send mail from a python script the mail doesn't get sent, it's just stuck in the queue:
The python script looks like this:
Code:
beaver@rocks001 ~# mailq
/var/spool/mqueue (1 request)
-----Q-ID----- --Size-- -----Q-Time----- ------------Sender/Recipient-----------
n3MDYKjb000845 3231 Wed Apr 22 15:34 <admin@rocks001>
(Deferred: Name server: mail.XXXXX.no.: host name lookup failur)
Code:
msg = MIMEText(mail)
msg['Subject'] = 'Packages'
msg['From'] = fromaddr
msg['To'] = toaddrs
msg['Content-Type'] = 'text/html'
server = smtplib.SMTP('localhost')
server.sendmail(fromaddr, toaddrs, msg.as_string())
server.quit()