When sending email I keep getting the following error: [email protected] | System.Net.Mail.SmtpFailedRecipientException: Mailbox unavailable. The server response was: web139.discountasp.net (web139) [64.209.135.9]:3890 is currently not The errormessage is normally truncated. The address in the To: field can vary from that above but isnormally outside of my domain viz aquarius.com.au . The strange thing is that the Bcc: email is being delivered fine. Here's my code edited for brevity: SmtpClient myMailClient = new SmtpClient(); MailMessage myMailMessage = new MailMessage(); string mailHost = "smtp.aquarius.com.au"; string userName = "[email protected]"; string password = "xxxxx"; string fromName = "Sales"; string fromAddress = "[email protected]"; emailBody = "Message body here"; string address = GetValue("email"); string fullName = GetValue("firstName") + " " + GetValue("lastName"); myMailMessage.To.Add(new MailAddress(address, fullName)); myMailMessage.Bcc.Add(new MailAddress("[email protected]", "Sales Department")); myMailMessage.From = new MailAddress(fromAddress, fromName); myMailMessage.Subject =" Licence Purchase"; myMailMessage.IsBodyHtml = true; myMailMessage.Priority = MailPriority.Normal; myMailClient.Host = mailHost; myMailClient.Port = 25; myMailClient.DeliveryMethod = SmtpDeliveryMethod.Network; NetworkCredential myMailCredential = new NetworkCredential(); myMailCredential.UserName = userName; myMailCredential.Password = password; myMailClient.UseDefaultCredentials = false; myMailClient.Credentials = myMailCredential; myMailClient.Send(myMailMessage); I am not using any email specific settings in my web.config file. I can't find any KB articles on the subject so can anyone help me please. Thanks.
Hi Glen, I use something like this, seems to work everytime; I've left out a lot of the intantiation of objects and error trapping etc for brevity, the full procedure is quite lengthy, uses LinkedResources and AlternateViews etc... ' Set the Priority property of the mail message [Low=0,Normal=1,High=2] objMailMessage.Priority = System.Net.Mail.MailPriority.Normal ' Populate the smtp server name strSmtpMailServer = "smtp.yourdomain.com" ' Populate the smtp user name credential strSmtpUsername = "[email protected]" ' Populate the smtp password credential strSmtpPassword = "password" ' Create the NetworkCredential object Dim objNetworkCredential As New System.Net.NetworkCredential(strSmtpUsername, strSmtpPassword) ' Create the SmtpClient object Dim objSmtpClient As New System.Net.Mail.SmtpClient(strSmtpMailServer) ' Parse the NetworkCredential to the smtpclient object objSmtpClient.Credentials = objNetworkCredential ' Send the message. objSmtpClient.Send(objMailMessage) Alan