Newbie CGI confusion...

Robert Brewer fumanchu at amor.org
Thu Feb 19 19:37:20 CET 2004


Fred Mailhot wrote:
> I'm trying to write a script that will mail some data from a 
> web-based form
> to me, using the "mail" command (under Linux). The following 
> illustrates the
> crux of what I'm doing:
> cmdstring = 'mail -c %s -s "%s" -r %s %s' % (ccaddr, subject, usrmail,
> toaddr)

You might want to try the SMTP module in the Library (which should be
both more cross-platform and higher-level = easier to understand). It
will certainly save you the command-line-quoting headaches:

import smptlib

server = smtplib.SMTP(serverName)
response = server.sendmail(fromaddr, toaddrs, msg)
server.quit()


HTH

FuManChu




More information about the Python-list mailing list