Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #53559

Cannot form correctly the FORM part of the header when sending mail

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From Ferrous Cranus <nikos@superhost.gr>
Newsgroups comp.lang.python
Subject Cannot form correctly the FORM part of the header when sending mail
Date Tue, 03 Sep 2013 10:48:13 +0300
Organization A noiseless patient Spider
Lines 53
Message-ID <l0447t$t8a$4@dont-email.me> (permalink)
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 8bit
Injection-Date Tue, 3 Sep 2013 07:48:14 +0000 (UTC)
Injection-Info mx05.eternal-september.org; posting-host="1865306f023a6f1058723cbd7244828c"; logging-data="29962"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19DLGy6j3mhQrHcRkihen0+"
User-Agent Mozilla/5.0 (Windows NT 6.2; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8
Cancel-Lock sha1:wvisLQWmhZnkcYmvztJOAZXfYl8=
Xref csiph.com comp.lang.python:53559

Show key headers only | View raw


Hello,
i have written the following snipper of code to help me send mail:


=================================================================================================================
# if html form is submitted then send user mail
#================================================================================================================
if( mailform ):

     try:
         if (FROM is None) or (MESSAGE is None) or ('@' not in FROM) or 
('Γράψε μου εδώ' in MESSAGE):
             print( "<h2><font color=red>Συμπλήρωσε σωστά το mail σου 
και δώσε το σχολιασμό σου!</font></h2>" )
         else:
             # prepare mail data
             TO = "nikos@superhost.gr"

             SUBJECT = u"Mail από τον επισκέπτη: ( %s )" % FROM

             MESSAGE = "From: %s\r\n" + "To: %s\r\n" + "Subject: %s\r\n" 
+ MESSAGE + "\r\n"
             MESSAGE = MESSAGE % ( FROM, TO, SUBJECT )
             MESSAGE = MESSAGE.encode('utf-8')

             # open Gmail's SMTP server
             server = smtplib.SMTP('smtp.gmail.com:587')
             server.ehlo()
             server.starttls()

             # next, log in to the server
             server.login("nikos.gr33k@gmail.com", "rmrcdherpbsfggcw")

             # send the mail
             server.sendmail( FROM, [TO], MESSAGE )

             print( "<h2><font color=blue>Ευχαριστώ πολύ για το 
ενδιαφέρον! Θα επικοινωνήσω μαζί σου άμεσα :-)</font></h2>" )
     except Exception as e:
         print( repr(e), file=open( '/tmp/err.out', 'a' ) )

     sys.exit(0)
=======================================================================


It works as expected, but the the problem is that it display the FROM 
part as being send from ,my personal GMail account when it supposed to 
be shown the format variable field that was passed by index.html to the 
mail.py script.

Si there a workaround for that please?
-- 
Webhost <http://superhost.gr>

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Cannot form correctly the FORM part of the header when sending mail Ferrous Cranus <nikos@superhost.gr> - 2013-09-03 10:48 +0300
  Re: Cannot form correctly the FORM part of the header when sending mail feedthetroll@gmx.de - 2013-09-03 02:33 -0700
    Re: Cannot form correctly the FORM part of the header when sending mail Ferrous Cranus <nikos@superhost.gr> - 2013-09-03 13:44 +0300
  Re: Cannot form correctly the FORM part of the header when sending mail Piet van Oostrum <piet@vanoostrum.org> - 2013-09-03 22:14 -0400
    Re: Cannot form correctly the FORM part of the header when sending mail Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-09-04 02:31 -0700
      Re: Cannot form correctly the FORM part of the header when sending mail Piet van Oostrum <piet@vanoostrum.org> - 2013-09-04 12:16 -0400
        Re: Cannot form correctly the FORM part of the header when sending mail Piet van Oostrum <piet@vanoostrum.org> - 2013-09-04 17:38 -0400
        Re: Cannot form correctly the FORM part of the header when sending mail Ferrous Cranus <nikos@superhost.gr> - 2013-09-05 09:31 +0300
          Re: Cannot form correctly the FORM part of the header when sending mail Steven D'Aprano <steve@pearwood.info> - 2013-09-05 08:58 +0000
            Re: Cannot form correctly the FORM part of the header when sending mail Ferrous Cranus <nikos@superhost.gr> - 2013-09-05 12:34 +0300
              Re: Cannot form correctly the FORM part of the header when sending mail Ferrous Cranus <nikos@superhost.gr> - 2013-09-05 12:36 +0300
                Re: Cannot form correctly the FORM part of the header when sending mail Dave Angel <davea@davea.name> - 2013-09-05 10:33 +0000
                Re: Cannot form correctly the FORM part of the header when sending mail Ferrous Cranus <nikos@superhost.gr> - 2013-09-05 13:48 +0300
                Re: Cannot form correctly the FORM part of the header when sending mail feedthetroll@gmx.de - 2013-09-05 04:02 -0700
                Re: Cannot form correctly the FORM part of the header when sending mail Ferrous Cranus <nikos@superhost.gr> - 2013-09-05 14:20 +0300
                Re: Cannot form correctly the FORM part of the header when sending mail feedthetroll@gmx.de - 2013-09-05 05:18 -0700
                Re: Cannot form correctly the FORM part of the header when sending mail Ferrous Cranus <nikos@superhost.gr> - 2013-09-05 15:36 +0300
                Re: Cannot form correctly the FORM part of the header when sending mail feedthetroll@gmx.de - 2013-09-05 06:29 -0700
                Re: Cannot form correctly the FORM part of the header when sending mail Ferrous Cranus <nikos@superhost.gr> - 2013-09-05 16:38 +0300
                Re: Cannot form correctly the FORM part of the header when sending mail Ferrous Cranus <nikos@superhost.gr> - 2013-09-05 17:01 +0300
                Re: Cannot form correctly the FORM part of the header when sending mail alex23 <wuwei23@gmail.com> - 2013-09-06 13:38 +1000
                Re: Cannot form correctly the FORM part of the header when sending mail feedthetroll@gmx.de - 2013-09-05 08:00 -0700
                Re: Cannot form correctly the FORM part of the header when sending mail Ferrous Cranus <nikos@superhost.gr> - 2013-09-05 18:59 +0300
                Re: Cannot form correctly the FORM part of the header when sending mail feedthetroll@gmx.de - 2013-09-05 09:50 -0700
                Re: Cannot form correctly the FORM part of the header when sending mail Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-09-05 17:50 +0000
                Re: Cannot form correctly the FORM part of the header when sending mail Piet van Oostrum <piet@vanoostrum.org> - 2013-09-06 00:48 -0400
                Re: Cannot form correctly the FORM part of the header when sending mail Ferrous Cranus <nikos@superhost.gr> - 2013-09-06 09:44 +0300
                Re: Cannot form correctly the FORM part of the header when sending mail Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-09-05 17:28 +0000
              Re: Cannot form correctly the FORM part of the header when sending mail Piet van Oostrum <piet@vanoostrum.org> - 2013-09-05 11:19 -0400
    Re: Cannot form correctly the FORM part of the header when sending mail Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-09-04 02:57 -0700
      Re: Cannot form correctly the FORM part of the header when sending mail Dave Angel <davea@davea.name> - 2013-09-04 11:15 +0000
        Re: Cannot form correctly the FORM part of the header when sending mail Ferrous Cranus <nikos@superhost.gr> - 2013-09-04 14:29 +0300
          Re: Cannot form correctly the FORM part of the header when sending mail Dave Angel <davea@davea.name> - 2013-09-04 12:21 +0000
      Re: Cannot form correctly the FORM part of the header when sending mail Piet van Oostrum <piet@vanoostrum.org> - 2013-09-04 12:22 -0400
  Re: Cannot form correctly the FORM part of the header when sending mail Heiko Wundram <modelnine@modelnine.org> - 2013-09-04 14:18 +0200
    Re: Cannot form correctly the FORM part of the header when sending mail Ferrous Cranus <nikos@superhost.gr> - 2013-09-04 17:29 +0300
      Re: Cannot form correctly the FORM part of the header when sending mail Piet van Oostrum <piet@vanoostrum.org> - 2013-09-04 13:33 -0400
    Re: Cannot form correctly the FORM part of the header when sending mail Piet van Oostrum <piet@vanoostrum.org> - 2013-09-04 12:06 -0400
    How to exit a cgi file after a download Ferrous Cranus <nikos@superhost.gr> - 2013-09-04 12:49 -0400
    How to exit a cgi file after a download. inq1ltd <inq1ltd@inqvista.com> - 2013-09-04 14:44 -0400
    Re: How to exit a cgi file after a download. Joel Goldstick <joel.goldstick@gmail.com> - 2013-09-04 15:42 -0400
      Re: How to exit a cgi file after a download. alex23 <wuwei23@gmail.com> - 2013-09-05 09:56 +1000
    Re: How to exit a cgi file after a download random832@fastmail.us - 2013-09-04 16:23 -0400
    Re: How to exit a cgi file after a download Benjamin Kaplan <benjamin.kaplan@case.edu> - 2013-09-04 13:51 -0700
  Re: How to exit a cgi file after a download inq1ltd <inq1ltd@inqvista.com> - 2013-09-05 12:33 -0400

csiph-web