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

Denis McMahon denismfmcmahon at gmail.com
Tue Sep 17 12:30:36 EDT 2013


On Tue, 17 Sep 2013 18:17:43 +0300, Ferrous Cranus wrote:

> So cant this be done in python or not?
> or is a mtetr of configuring the MTA? conf file?

Python can not control data that is added to the message after it has 
left the python program. If you want to retain maximum possible control 
of the mail process from within python, you need to use a python module 
that handles the smtp exchange with the destination mta, however even 
then you can not control the content of header lines added by that 
destination mta, which will invariably include the real[1] ip address of 
your system.

[1] The ip address that it is sending ack packets to as part of the smtp 
session, so unless you're using a proxy somewhere, this will be your 
system's ip address. Can't fake it. If the other system doesn't know your 
ip address, it can't send acks, and the tcp session fails.

-- 
Denis McMahon, denismfmcmahon at gmail.com



More information about the Python-list mailing list