Tryign to send mail via a python script by using the local MTA

Ferrous Cranus nikos.gr33k at gmail.com
Mon Sep 16 07:37:48 EDT 2013


Στις 16/9/2013 2:21 μμ, ο/η Denis McMahon έγραψε:
> On Mon, 16 Sep 2013 12:06:06 +0200, Joost Molenaar wrote:
>
>> It's most likely an issue in your local SMTP server's configuration.
>
> I'm not convinced about that. All the evidence is that OPs local mta
> delivers the message to google. I think the issue is that google are
> deciding the message is junk and dropping it in the bit recycling bin.
>
> This is just as likely to be a feature of the random_char(50) subject and
> random_char(500) message text as it is any local mta settings. I have no
> idea what OPs random_char(x) does, but I also see no proof it doesn't
> insert data that's illegal in subject or body. Even if it creates a
> wholly valid message subject and body, it might look like something spammy
> to google.
>
> starttls suggests that whatever his mta is, it's using some form of auth
> to communicate with gmail. It looks like his mail is delivered to the
> google servers.
>
> If he's trying to prove communication works, he might be better off using
> a message subject of "test" and a message body of "this is a test
> message".
>
Hello Denis and thanks for dropping into the conversation.

here is the code again with the random function definition:

# 
=================================================================================================================
# 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, 10):
	try:
		# prepare mail data
		FROM = random_char(8) + '@' + random_char(5) + '.com'
		TO = "nkouras at ath.forthnet.gr"
			
		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)
=================================================================


i have sent 10 mails to my personal Google account and i though they 
were never get delivered but it seems that every half an hour or so, 
one-by-one come into appearance into my GMail account which i access via 
Thunderbird!

I don't know whats delaying them so long but they do come.

What i want now is to be able to alter the hostname of my server so the 
mails wont indicate that they derive from superhost.gr as they aare now 
sen in the mail headers.

I will show you an example when one more mail arrive into my gmail account.




More information about the Python-list mailing list