Search The ForumSearch   RegisterRegister  LoginLogin

MailBee.NET SMTP

 AfterLogic Forum : MailBee.NET SMTP
Subject Topic: Use a specific IP for sending mail Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
shoey1
Newbie
Newbie
Avatar

Joined: 19 March 2014
Location: United Kingdom
Online Status: Offline
Posts: 5
Posted: 27 March 2014 at 8:41am | IP Logged Quote shoey1

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 View shoey1's Profile Search for other posts by shoey1
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 27 March 2014 at 8:49am | IP Logged Quote Alex

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 View Alex's Profile Search for other posts by Alex
 
shoey1
Newbie
Newbie
Avatar

Joined: 19 March 2014
Location: United Kingdom
Online Status: Offline
Posts: 5
Posted: 28 March 2014 at 2:17am | IP Logged Quote shoey1

Thanks Alex,

I will look into that.

Paul
Back to Top View shoey1's Profile Search for other posts by shoey1
 
shoey1
Newbie
Newbie
Avatar

Joined: 19 March 2014
Location: United Kingdom
Online Status: Offline
Posts: 5
Posted: 28 March 2014 at 2:25am | IP Logged Quote shoey1

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 View shoey1's Profile Search for other posts by shoey1
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 28 March 2014 at 3:18am | IP Logged Quote Alex

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 View Alex's Profile Search for other posts by Alex
 
renoldscott
Newbie
Newbie


Joined: 21 March 2014
Location: United States
Online Status: Offline
Posts: 4
Posted: 07 May 2014 at 12:32am | IP Logged Quote renoldscott

Good to know about use of SmtpServer.LocalEndPoint property.
Back to Top View renoldscott's Profile Search for other posts by renoldscott Visit renoldscott's Homepage
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide