how to avoid to being identified as spam when using smtplib in python
<pre><code>import smtplib

smtp = smtplib.SMTP()
smtp.connect('smtp.163.com', '25')


from_addr = 'XXX@163.com'
to_addr = 'XXX@qq.com'


smtp.login(from_addr, 'XXXX')



msg = ('From: %s\r\nTo: %s\r\n'
% (from_addr, to_addr))

msg = msg + '''Subject: Test

Hi, I just test this format!!
Just python send mail test - -.'''

smtp.sendmail(from_addr, to_addr, msg)
smtp.quit()
</code></pre>

<p>I dont know why the message has been always classified as spam, I will appreciate for any advice for me.</p>

<p>I had a similar issue and the work-around was to set a message ID:</p>

<pre><code>from email.utils import make_msgid
msg['Message-ID'] = make_msgid()
</code></pre>

<p>It is just a clue, I do not know if this fix will fit for you.</p>

python smtp spam