Menu

#278 Option to set client address

open
smtp (5)
5
2007-12-03
2007-12-03
Anonymous
No

The EHLO client address comes from [info hostname] or is set to localhost if sending email to the localhost server but this is not sufficient. For example I want to send an email from my desktop system using my ISP's mail server and it requires that the EHLO client is a FQDN but my system is setup with a simple hostname of "deth". Because of this, sending emails fails yet I can send an email just fine from Thunderbird. In looking at the conversation between Thunderbird and my mail server, I see that Thunderbird is sending "EHLO 127.0.0.1" so I would like the option to do this as well so that I can send emails properly from my software.

The changes for this are just to allow a -client option to the ::stmp::sendmessage proc and add code in the initialize variables area (right by where username is set to {}) like this:

set client {}

Then in the option parsing add this:

-client { set client $value }

And then change the code to get the client like this:

if { $client == "" } {
if { [string compare $server localhost] } {
set client localhost
} else {
set client [info hostname]
}
}

Thats it! Now I can specify "-client 127.0.0.1" and sending the email works properly.

This is from bpepers@linuxcanada.com

Discussion