Improved SmtpServer constructor
Status: Beta
Brought to you by:
mikelbridge
I have improved an SmtpServer constructor. Now it
accepts server IP and port number in one string. Like
"127.0.0.1:25".
/// <summary>
/// Create a new SMTP server at this hostname and
/// port.
/// </summary>
/// <param name="hostname">The address or hostname of
the smtp server. May contain
/// port number.</param>
public SmtpServer(String hostname)
{
int separatorIndex = hostname.IndexOf(':');
if (separatorIndex > -1)
{
_port = Convert.ToInt32(
hostname.Substring(separatorIndex+1) );
_id = hostname;
hostname = hostname.Substring(0, separatorIndex);
}
else
{
_id=hostname+":"+_port;
}
_hostname=hostname;
}