Στις 16/9/2013 4:52 πμ, ο/η Steven D'Aprano έγραψε:
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.gr...@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 of course i have imported the 'os' module.
I try to send mail from different FROM filed just like as a visitor guest will use the webform to compete his own email.

but since you ask here is the whole code with the function displayed too.

#=================================================================================================================
# if html form is submitted then send user mail
#=================================================================================================================
def random_char( y, chars=string.ascii_uppercase + string.digits ):
        return ''.join( random.choice(chars) for x in range(y) )


for times in range(0, 1):
        try:
                # prepare mail data
                FROM = random_char(10) + '@' + random_char(10) + '.com'
                TO = "nikos.gr...@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)
==================================================================================================================


Is there a way to avoid the hostname and the ip address from being revealed when i'am sending an email?

Because the mails finally got delivered to my gmail account after many hours of delay, and in the headers they are detailes like hostname and ip address of my server which i dont want to be revealed.

i can alter FROM, TO, subject, message can i also alter the hostname fo the server the the mail derived from?

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to