Author |
|
Neil_Knight Newbie
Joined: 06 December 2011 Location: United Kingdom
Online Status: Offline Posts: 30
|
Posted: 07 February 2012 at 1:54am | IP Logged
|
|
|
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 |
|
|
Neil_Knight Newbie
Joined: 06 December 2011 Location: United Kingdom
Online Status: Offline Posts: 30
|
Posted: 07 February 2012 at 1:55am | IP Logged
|
|
|
The title of the post should have been "HelloDomain not populated", but I can't edit posts.
|
Back to Top |
|
|
Alex AfterLogic Support
Joined: 19 November 2003
Online Status: Offline Posts: 2206
|
Posted: 07 February 2012 at 5:08am | IP Logged
|
|
|
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 |
|
|
Neil_Knight Newbie
Joined: 06 December 2011 Location: United Kingdom
Online Status: Offline Posts: 30
|
Posted: 07 February 2012 at 5:10am | IP Logged
|
|
|
Thanks Alex. This information is helpful and as per my other post it certainly explains a lot.
|
Back to Top |
|
|