views:

38

answers:

0

We have an internal program that runs on each user's computer on logon and occasionally it'll need to send an email. This used to work 100% of the time on Exchange 2003 but we've recently upgraded to Exchange 2007 and a lot of the time it fails with this exception.

        MailAddress _sender = new MailAddress("[email protected]", "Sender");
        SmtpClient _server = new SmtpClient("MAIL.DOMAIN.com.au");
        MailMessage message = new MailMessage();
        message.Sender = _sender;
        message.To.Add("[email protected]");
        message.Subject = subject;
        message.IsBodyHtml = true;
        message.From = _sender;
        message.Body = startOfBody + body + endOfBody;

Can anyone explain why it fails sporadically?