At this point, I am inclined to decide that SMTP stands for “Stoopid Mother Truckin’ Program”, after some frankly bizarre shenanigens with SMTP on one particluar server. Thankfully, MailEnable came to the rescue. This is a well-engineered bit of software, and best of all, it’s free, even for commercial use (Enterprise users pay for high-end features).
The difficulties arose with a DotNetNuke installation, incombination with some stubbornly unconfigurable SMTP services. FOr example, the main SMTP server on the machine could not be configured to talk to web applications, and a second SMTP server program was available to do this, on another port (i.e. not port 25).
HOWEVER, it turns out that DNN does not allow you to specify an SMTP server on a port except port 25. In other words, a setting like this will not have the desired effect:
The port is ignored by the
System.Web.Mail.SmtpMail class as used by DNN. I checked the source for DNN 3.2.2, and the port number is NOT parsed out from the servername string. This seems to me to be a serious limitation. A line or two of extra code would enable mail sending on alternative ports: parse out the port number, and if its there, set the port explicitly for the mail message before sending:
' line 152 or Mail.vb: ' external SMTP server If SMTPServer "" Then ' TODO: parse out port number here Web.Mail.SmtpMail.SmtpServer = SMTPServer Select Case SMTPAuthentication Case "", "0" ' anonymous Case "1" ' basic If SMTPUsername "" And SMTPPassword "" Then objMail.Fields("http://schemas.microsoft.com/ cdo/configuration/smtpauthenticate") = 1 objMail.Fields("http://schemas.microsoft.com/ cdo/configuration/sendusername") = SMTPUsername objMail.Fields("http://schemas.microsoft.com/ cdo/configuration/sendpassword") = SMTPPassword ' TODO: Insert port here... End If Case "2" ' NTLM objMail.Fields("http://schemas.microsoft.com/ cdo/configuration/smtpauthenticate") = 2 End Select End If
So I was left having to use a server on the default port 25, but with only a single machine it’s tricky to get SmartHost relaying working properly (in fact, it might be impossible – I haven’t checked the RFCs).
In the end, I disabled the two existing SMTP servers, and installed MailEnable from http://www.mailenable.com/standard_edition.asp – it is very easy to use and configure. Crucially, it can listen on two different ports, and had no limitation with respect to web applications.
I highly recommend it if you are having similar problems.