Search The ForumSearch   RegisterRegister  LoginLogin

MailBee.NET SMTP

 AfterLogic Forum : MailBee.NET SMTP
Subject Topic: Hello not populated Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
Neil_Knight
Newbie
Newbie


Joined: 06 December 2011
Location: United Kingdom
Online Status: Offline
Posts: 30
Posted: 07 February 2012 at 1:54am | IP Logged Quote Neil_Knight

I have the following code:
Code:

MailBee.SmtpMail.Smtp.LicenseKey = ConfigurationManager.AppSettings["MailBee.SmtpMail.Smtp.LicenseKey"];
Smtp mailer = new Smtp();
mailer.DnsServers.Autodetect();
Console.WriteLine(mailer.DirectSendDefaults.HelloDomain.ToString()); // This is empty
Console.WriteLine(mailer.DirectSendDefaults.SmtpOptions.ToString()); // Displays Default
Console.ReadLine();


The documentation says that it will use the local host name or the local IP address of the machine. Why is this returning an empty string?
Back to Top View Neil_Knight's Profile Search for other posts by Neil_Knight
 
Neil_Knight
Newbie
Newbie


Joined: 06 December 2011
Location: United Kingdom
Online Status: Offline
Posts: 30
Posted: 07 February 2012 at 1:55am | IP Logged Quote Neil_Knight

The title of the post should have been "HelloDomain not populated", but I can't edit posts.
Back to Top View Neil_Knight's Profile Search for other posts by Neil_Knight
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 07 February 2012 at 5:08am | IP Logged Quote Alex

MailBee checks that if this name is empty, it autodetects what to use for that name. But the property will still read empty value.

Here's how MailBee autodetects it
Code:

// If HelloDomain not specified, use local host name
// but try to get local IP address if possible.
domain = Dns.GetHostName();
IPHostEntry host = Dns.Resolve(domain);
foreach (IPAddress ip in host.AddressList)
{
     if (ip.AddressFamily == AddressFamily.InterNetwork)
     {
          domain = "[" + ip.ToString() + "]";
          break;
     }
}


Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 
Neil_Knight
Newbie
Newbie


Joined: 06 December 2011
Location: United Kingdom
Online Status: Offline
Posts: 30
Posted: 07 February 2012 at 5:10am | IP Logged Quote Neil_Knight

Thanks Alex. This information is helpful and as per my other post it certainly explains a lot.
Back to Top View Neil_Knight's Profile Search for other posts by Neil_Knight
 

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