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

Ferrous Cranus nikos.gr33k at gmail.com
Tue Sep 17 17:42:22 EDT 2013


On 17/9/2013 7:30 μμ, Denis McMahon wrote:
> 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.
>
Ah, now we are getting somewhere.

So the foreign MTA tests for real time connectivity with the local MTA 
and it tries to detect a working host and ip address.

So even if we alter the hostname and the ip address of our localhost 
then the smtp procedure will fail correct?



More information about the Python-list mailing list