1

I have a working mail server running Debian stable, the following elements are working.

  1. SPF
  2. DKIM
  3. rDNS

My IP is not listed in any backlist, I used: mxtoolbox.com for all this.

My problem: Sending emails to hotmail with a python script sometimes doesn't work. The mail gets sent but the recipient doesn't get it (or goes to spam). This doesn't ever happen when sending to my account so I don't even know what happens.

This is the script (Maybe I'm missing a header?) Consider that, at the moment, security is not a concern (I'm not checking the parameters at all)


#!/usr/bin/python
import sys
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText

if len(sys.argv)!=3:
        print "2 parameter, mail subject (quoted)"
        sys.exit(1)

sender = 'sender@domain.com.ar'
receiver = sys.argv[1] 

msg = MIMEMultipart('alternative')
msg['Subject'] = sys.argv[2]
msg['From'] = sender
msg['To'] = receiver

with open('mailtext', 'r') as content_file:
    message= content_file.read()

msg.attach(MIMEText(message,'html'))
s = smtplib.SMTP('localhost')
    s.sendmail(sender, receiver, msg.as_string())
    s.quit()

This is my mail.log for the mail I sent

Nov 10 14:20:59 domain postfix/smtpd[11743]: connect from domain.com.ar[127.0.0.1]
Nov 10 14:20:59 domain postfix/smtpd[11743]: 2668943282: client=domain.com.ar[127.0.0.1]
Nov 10 14:21:00 domain postfix/cleanup[11749]: 2668943282: message-id=
Nov 10 14:21:00 domain postfix/qmgr[4185]: 2668943282: from=, size=836, nrcpt=1 (queue active)
Nov 10 14:21:00 domain postfix/smtpd[11743]: disconnect from domain.com.ar[127.0.0.1]
Nov 10 14:21:04 domain postfix/smtpd[11761]: connect from domain.com.ar[127.0.0.1]
Nov 10 14:21:04 domain postfix/smtpd[11761]: 9F19843285: client=domain.com.ar[127.0.0.1]
Nov 10 14:21:04 domain postfix/cleanup[11749]: 9F19843285: message-id=
Nov 10 14:21:04 domain postfix/qmgr[4185]: 9F19843285: from=, size=1262, nrcpt=1 (queue active)
Nov 10 14:21:04 domain postfix/smtpd[11761]: disconnect from domain.com.ar[127.0.0.1]
Nov 10 14:21:04 domain amavis[10275]: (10275-15) Passed CLEAN {RelayedInternal}, MYNETS/MYUSERS LOCAL [127.0.0.1]:45027 [127.0.0.1]  -> , Queue-ID: 2668943282, Message-ID: , mail_id: 16V7UTH-mVAO, Hits: -7.345, size: 835, queued_as: 9F19843285, 4471 ms
Nov 10 14:21:04 domain postfix/smtp[11756]: 2668943282: to=, relay=127.0.0.1[127.0.0.1]:10024, delay=5.6, delays=1.1/0.01/0.01/4.5, dsn=2.0.0, status=sent (250 2.0.0 from MTA(smtp:[127.0.0.1]:10025): 250 2.0.0 Ok: queued as 9F19843285)
Nov 10 14:21:04 domain postfix/qmgr[4185]: 2668943282: removed
Nov 10 14:21:06 domain postfix/smtp[11762]: 9F19843285: to=, relay=mx1.hotmail.com[65.54.188.94]:25, delay=1.4, delays=0.01/0.02/0.86/0.51, dsn=2.0.0, status=sent (250   Queued mail for delivery)
Nov 10 14:21:06 domain postfix/qmgr[4185]: 9F19843285: removed

Anything obvious I'm missing?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.