Author |
|
shoey1 Newbie
Joined: 19 March 2014 Location: United Kingdom
Online Status: Offline Posts: 5
|
Posted: 27 March 2014 at 8:41am | IP Logged
|
|
|
Hi,
I have a server that has two public internet facing IP addresses for this explanation assuming 10.10.10.10 and 10.10.10.11.
If use the SMTP client to send a email mail direct, is there any way to set what public IP address the SMTP client will use to send the email?
Thanks
Paul
|
Back to Top |
|
|
Alex AfterLogic Support
Joined: 19 November 2003
Online Status: Offline Posts: 2206
|
Posted: 27 March 2014 at 8:49am | IP Logged
|
|
|
Use SmtpServer.LocalEndPoint property for that. LocalEndPoint also exists for other classes (such as in case if you're using direct send rather than send via SMTP relay).
Regards,
Alex
|
Back to Top |
|
|
shoey1 Newbie
Joined: 19 March 2014 Location: United Kingdom
Online Status: Offline Posts: 5
|
Posted: 28 March 2014 at 2:17am | IP Logged
|
|
|
Thanks Alex,
I will look into that.
Paul
|
Back to Top |
|
|
shoey1 Newbie
Joined: 19 March 2014 Location: United Kingdom
Online Status: Offline Posts: 5
|
Posted: 28 March 2014 at 2:25am | IP Logged
|
|
|
Hi Alex,
Just wanted to confirm something like this should work in this scenario.
Mailer is an instance of the SMTP class
Mailer.DnsServers.Autodetect();
Mailer.DirectSendDefaults.HelloDomain = "RDNS OF IP";
Mailer.DirectSendDefaults.LocalEndPoint = newIPEndPoint(IPAddress.Parse("10.10.10.11"), 25);
This would ensure that all mail would be delivered over the 10.10.10.11 IP address rather than the 10.10.10.10 IP Address.
Thanks
Paul
|
Back to Top |
|
|
Alex AfterLogic Support
Joined: 19 November 2003
Online Status: Offline Posts: 2206
|
Posted: 28 March 2014 at 3:18am | IP Logged
|
|
|
It's mostly correct. One note, though.
Mailer.DirectSendDefaults.LocalEndPoint = newIPEndPoint(IPAddress.Parse("10.10.10.11"), 25);
I recommend using port 0 (use any available port) here. Port 25 is for remote end points. Local end point can use any port which is not occupied by another application. If you select port 25 here and your machine already runs SMTP service, the port won't be available and the sending will fail.
The only reason to specify non-zero port for local end points is a firewall. For instance, your firewall may be configure to block outbound connections made from all but very limited set of ports. In this case, you must provide the port from the allowed range. That port number, however, still has nothing to do with the value of 25. It can be any value which allowed by the firewall.
Regards,
Alex
|
Back to Top |
|
|
renoldscott Newbie
Joined: 21 March 2014 Location: United States
Online Status: Offline Posts: 4
|
Posted: 07 May 2014 at 12:32am | IP Logged
|
|
|
Good to know about use of SmtpServer.LocalEndPoint property.
|
Back to Top |
|
|