title: adding attachment using sendmail from unix
body: <p>I am using the following code to send email from unix. </p>
  
  <p>Code</p>
  
  <pre><code>#!/usr/bin/python
  import os
  def sendMail():
      sendmail_location = "/usr/sbin/sendmail" # sendmail location
      p = os.popen("%s -t" % sendmail_location, "w")
      p.write("From: %s\n" % "myname@company.com")
      p.write("To: %s\n" % "yourname@company.com")
      p.write("Subject: My Subject \n")
      p.write("\n") # blank line separating headers from body
      p.write("body of the mail")
      status = p.close()
      if status != 0:
             print "Mail Sent Successfully", status
      sendMail()
  </code></pre>
  
  <p>I am not sure how to add attachment to this email (attachment being on a different directory /my/new/dir/)</p>