September 16th, 2013, 04:08 AM
Trying to send a mail by altering the mail headers
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):
# prepare mail data
FROM = random_char(10) + '@' + random_char(10) + '.com'
TO = "email@example.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() ) )
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?
What is now proved was once only imagined!