Sending a mail

Michael Ströder x_mst at propack-data.com
Mon Aug 23 12:51:01 EDT 1999


Peter Posselt Vestergaard wrote:
> 
> I want my script to send a mail with a specific subject. I've tried to
> import and use the smtplib, but I get the message that it doesn't exist

You should really try smtplib since it's portable.

> - maybe it isn't implemented on the server I'm using, and anyway - I
> can't specify a subject using the sendmail()-command...

Read the smptlib docs more carefully. You have to write the whole header
containing From:, Subject: etc. yourself.

> text='echo "hello"|mailto posselt at daimi.au.dk -s "important message"'
> os.system(text)
> 
> This works quite fine in my python interpreter, but not then I put it on
> the web.

This depends on your web server's OS and mail installation. Anyway you
have to ask your webmaster how to send e-mail from the shell.

> I tried to print out the standardoutput from os.system(text)
> and it was 256.

Did you really printed stdout? 256 seems to be the return code of the
os.system() call.

Ask your webmaster to install the missing smptlib.

Ciao, Michael.




More information about the Python-list mailing list