title: Python: Mail sent by script is marked as spam by Gmail
body: <p>We have a python script that sends mails everyday to an xml list of addresses. Those mails are always marked as spam by Gmail. Here's the code: </p>
  
  <pre><code>            email_body =  '&lt;html&gt;&lt;body&gt;&lt;div style="text-align: center; font-family: serif; font-size: 15px;"&gt;&lt;br/&gt;&lt;br/&gt;@&lt;br/&gt;&lt;br/&gt;' + text_splited[i] + '&lt;br/&gt;&lt;br/&gt;@&lt;br/&gt;&lt;br/&gt;&lt;a href="http://anemailstory.net/"&gt;&lt;i&gt;Tr@ces&lt;/i&gt;&lt;/a&gt;&lt;br/&gt;&lt;br/&gt; - &lt;br/&gt;&lt;br/&gt;&lt;a href="http://anemailstory.net/unsubscribe.html"&gt;unsubscribe&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;&lt;/div&gt;&lt;/body&gt;&lt;/html&gt;'  
  #text corresponding to that subcription date    
  
              # email     
              msg = MIMEMultipart('alternative') #Create Multipart msg (allows html)
              msg['To'] = email.utils.formataddr(('Recipient', 'readers@traces.net'))
              msg['From'] = email.utils.formataddr(('Traces', 'traces@anemailstory.net'))
              msg['Subject'] = 'Tr@ces - Part #' + str((i+2))
  
              part_html = MIMEText(email_body, 'html')
              msg.attach(part_html)
  
              server = smtplib.SMTP('localhost')
              server.set_debuglevel(False) # show communication with the server
              try:
                  server.sendmail('traces@noreply.net', email_addrs, msg.as_string())
              finally:
                  server.quit()
  </code></pre>
  
  <p>And here's the generated email:</p>
  
  <pre><code>Return-path: &lt;traces@noreply.net&gt;
  Envelope-to: mimmo@mimmo.com
  Delivery-date: Wed, 25 Apr 2012 23:59:07 -0600
  Received: from localhost ([127.0.0.1] helo=host131.hostmonster.com)
      by host131.hostmonster.com with esmtp (Exim 4.76)
      (envelope-from &lt;traces@noreply.net&gt;)
      id 1SNHjO-0006T0-C2; Wed, 25 Apr 2012 23:59:06 -0600
  Content-Type: multipart/alternative;
      boundary="===============1468314745133566460=="
  MIME-Version: 1.0
  To: Recipient &lt;readers@traces.net&gt;
  From: Traces &lt;traces@anemailstory.net&gt;
  Subject: Tr@ces - Part #9
  X-Identified-User: {:host131.hostmonster.com:andrecas:host131.hostmonster.com} {sentby:program running on server}
  
  --===============1468314745133566460==
  Content-Type: text/html; charset="us-ascii"
  MIME-Version: 1.0
  Content-Transfer-Encoding: 7bit
  
  &lt;html&gt;&lt;body&gt;&lt;div style="text-align: center; font-family: serif; font-size: 15px;"&gt;&lt;br/&gt;&lt;br/&gt;@&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;Mail content&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;@&lt;br/&gt;&lt;br/&gt;&lt;a href="http://anemailstory.net/"&gt;&lt;i&gt;Tr@ces&lt;/i&gt;&lt;/a&gt;&lt;br/&gt;&lt;br/&gt; - &lt;br/&gt;&lt;br/&gt;&lt;a href="http://anemailstory.net/unsubscribe.html"&gt;unsubscribe&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;&lt;/div&gt;&lt;/body&gt;&lt;/html&gt;
  --===============1468314745133566460==--
  </code></pre>
  
  <p>Do you have any solution for this?</p>
  
  <p>Thanks.</p>