<appSettings> <add key="SiteSmtpServer" value="localhost"></add> </appSettings>In this example, I specify localhost (it's an app I'm working on developing on my local box at the moment) but that could be any valid smtp server's hostname or ip address. Then in my code I would write
Dim objSmtp As System.Web.Mail.SmtpMail objSmtp.SmtpServer = ConfigurationSettings.AppSettings("SiteSmtpServer")I can then generate a System.Web.Mail.MailMessage and send it with the SmtpMail object I've already created.
Dim objMail As New System.Web.Mail.MailMessage objMail.Subject = "Here is the subject" objMail.Body = "Here is the body of the message" objMail.To = "youremail@yourdomain.com" objMail.From = "jerwin@visionds.com" objSmtp.Send(objMail)If in fact it turns out that you're already specifying an smtp server, or this doesn't resolve your issue, it could be that whatever smtp server you are using is having issues that when you call the send method, the server is offline, overloaded or otherwise unavailable to send it. Working around this would require adding some kind of queueing for your messages where you have another service running that will queue your messages and keep trying to send them until the server is available and they are sent. I believe you can find something that does this from quiksoft (www.quiksoft.com) called EasyMail SMTP Express.
>Could not access 'CDO.Message' object>Since this happens only once in a while, I suspect that it is either network connectivity related or possibly the SMTP Server itslef is not responding for some reason.