# Sendmail DNS issue



## erikf154 (Apr 22, 2009)

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:

```
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)
```
The python script looks like this:

```
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()
```


----------



## SirDice (Apr 22, 2009)

Check if resolving works correctly and you're able to get the MX record for that domain: *dig some.domain.com MX*


----------



## erikf154 (Apr 23, 2009)

Yup, it resolves correctly


----------

