Tryign to send mail via a python script by using the local MTA
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Sun Sep 15 21:52:38 EDT 2013
Hi Nikos,
I'm now going to put as much care and attention into my answer as you put
into your question.
Have uy tryed imprting os first? u nmeed to do
improt os
first or it wont work.,
When you give evidence of caring about the questions you ask, I'll start
caring about the answers I give you.
On Sun, 15 Sep 2013 08:54:48 -0700, Ferrous Cranus wrote:
> try:
> # prepare mail data
> FROM = random_char(10) + '@' + random_char(10) + '.com' TO =
> "nikos.gr33k at gmail.com"
>
> SUBJECT = random_char( 50 )
> MESSAGE = random_char( 500 )
>
> os.system( "echo %s | mailx -v -r %s -s %s %s" % (MESSAGE, FROM,
> SUBJECT, TO) )
>
> print( "<h2><font color=blue>%sη αποστολή προς %s
> επετεύχθη!</font></h2>" % (times, TO) )
> except Exception as e:
> print( "sendmail => ", date, repr( sys.exc_info() ) )
>
> sys.exit(0)
--
Steven
More information about the Python-list
mailing list