I check the code and do some testing tonight. The smtp works fine. First of all let's learn more about the System.Net.SmtpClient and see what have happen when Smtp ctor. The following code is the SmtpClient source that i reflected
1:
2: public SmtpClient()
3: {
4: if (Logging.On)
5: {
6: Logging.Enter(Logging.Web, "SmtpClient", ".ctor", "");
7: }
8: try
9: {
10: //This method init all properties of the SmtpClient
11: this.Initialize();
12: }
13: finally
14: {
15: if (Logging.On)
16: {
17: Logging.Exit(Logging.Web, "SmtpClient", ".ctor", this);
18: }
19: }
20: }
21:
22: private void Initialize()
23: {
24: if ((this.port == defaultPort) || (this.port == 0))
25: {
26: new SmtpPermission(SmtpAccess.Connect).Demand();
27: }
28: else
29: {
30: new SmtpPermission(SmtpAccess.ConnectToUnrestrictedPort).Demand();
31: }
32: this.transport = new SmtpTransport(this);
33: if (Logging.On)
34: {
35: Logging.Associate(Logging.Web, this, this.transport);
36: }
37: this.onSendCompletedDelegate = new SendOrPostCallback(this.SendCompletedWaitCallback);
38: if (MailConfiguration.Smtp != null)
39: {
40: if (MailConfiguration.Smtp.Network != null)
41: {
42: if ((this.host == null) || (this.host.Length == 0))
43: {
44: this.host = MailConfiguration.Smtp.Network.Host;
45: }
46: if (this.port == 0)
47: {
48: this.port = MailConfiguration.Smtp.Network.Port;
49: }
50: this.transport.Credentials = MailConfiguration.Smtp.Network.Credential;
51: this.transport.EnableSsl = MailConfiguration.Smtp.Network.EnableSsl;
52: if (MailConfiguration.Smtp.Network.TargetName != null)
53: {
54: this.targetName = MailConfiguration.Smtp.Network.TargetName;
55: }
56: this.clientDomain = MailConfiguration.Smtp.Network.ClientDomain;
57: }
58: this.deliveryMethod = MailConfiguration.Smtp.DeliveryMethod;
59: if (MailConfiguration.Smtp.SpecifiedPickupDirectory != null)
60: {
61: this.pickupDirectoryLocation = MailConfiguration.Smtp.SpecifiedPickupDirectory.PickupDirectoryLocation;
62: }
63: }
64: if ((this.host != null) && (this.host.Length != 0))
65: {
66: this.host = this.host.Trim();
67: }
68: if (this.port == 0)
69: {
70: this.port = defaultPort;
71: }
72: if (this.targetName == null)
73: {
74: this.targetName = "SMTPSVC/" + this.host;
75: }
76: if (this.clientDomain == null)
77: {
78: string hostName = IPGlobalProperties.InternalGetIPGlobalProperties().HostName;
79: StringBuilder builder = new StringBuilder();
80: for (int i = 0; i < hostName.Length; i++)
81: {
82: char ch = hostName[i];
83: if (ch <= '\x007f')
84: {
85: builder.Append(ch);
86: }
87: }
88: if (builder.Length > 0)
89: {
90: this.clientDomain = builder.ToString();
91: }
92: else
93: {
94: this.clientDomain = "LocalHost";
95: }
96: }
97: }
98:
As we see after config the smtp settings with web.config the SmtpClient will auto apply all the settings itself. We need not do that by manual.
The DNA Smtp testing mail use to test your smtp server whether can send email to your administrator email account. So it will not raise any exceptions even the smtp server sending error occurs. The testing passed when your administrator email account received the testing mail.