need help with nullmailer-inject in python cgi script to send attachements ?

tvmaly at gmail.com tvmaly at gmail.com
Thu Mar 24 08:20:06 EST 2005


Due to the restrictions I have at my host, I cannot use smtplib in my
email cgi script.  They gave me a script they use that calls
nullmailer-inject.   I am trying to figure out how to add the ability
to send attachments via the nullmailer-inject call.  I could not find
much documentation on google about nullmailer.  Has anyone used it
before to send attachments?   Here is function  I have so far that
sends a regular email.  The variables like recipient are set from a cgi
in another part of the script.

     thanks

             Ty

def genmail(reql):
  if nosend: return
  recip=recipient
  cap=form.keys()
  cap.sort()
  mailfl=os.popen('/usr/bin/nullmailer-inject -f '+fromaddr,'w')
  mailfl.write('To: '+recipient+nl)
  if fromaddr: mailfl.write('From: '+fromaddr+nl)
  mailfl.write('Subject: %s%s\n\n'%(subject,uri))
  mailfl.write(intro)
  rx=0
  prev=''
  for x in cap:
    while (rx<len(reql) and reql[rx]<x):
      if reql[rx]<>prev:
        putln(reql[rx],mailfl)
      rx=rx+1
    putln(x,mailfl)
    prev=x

  for x in envl:
    mailfl.write('%s: %s\n'%(x,env[x]))
  mailfl.close()




More information about the Python-list mailing list