SMTP Client - 'The SMTP host was not specified"
Posted on 2008-06-12
I am trying to send an email using the SMTPClient class but I keep getting the 'SMTP host was not specified error'. This is the code:
Dim smtpServer As SmtpClient
smtpServer = New SmtpClient()
smtpServer = Nothing
where emailMessage is an object of type MailMessage and is populated earlier in the function.
When I instantiate the object like this:
smtpServer = New SmtpClient("our.host")
it works correctly.
As I understand it, the SMTPClient should obtain the host from the config file:
The config file also contains system.diagnostic and runtime settings which I've left out for clarity.
Incidentally the framework is 2.0.
Any help would be much appreciated