|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Sending mails on Exchange 2007I have an Exchange 2007 working fine, and it’s possible to send and receive mails from mail clients to external domains. I try to send a mail from my application using this server. Te code is like this: MailAddress From = new MailAddress("sen***@mydomain.com", "Automated Sender"); MailAddress To = new MailAddress(***@externaldomain.com"); MailMessage myMail = new MailMessage(From, To); myMail.IsBodyHtml = true; myMail.Subject = "Automated mail"; myMail.Body = "Test mail..."; myMail.Sender = From; SmtpClient smtp = new SmtpClient("mailserver.mydomain.com"); smtp.UseDefaultCredentials = false; smtp.Credentials=new System.Net.NetworkCredential("username","password"); smtp.Send(myMail); It works if the destination domain is an internal domain, but with and external domain it launch an "Unable to relay" exception: "El buzón de correo no está disponible. La respuesta del servidor fue: 5.7.1 Unable to relay" English, aprox. translate: "Mailbox unavailable. Response from server: 5.7.1 Unable to relay" If I try to send a mail from Outlook with the authentication option active IT WORKS! This source code works with Exchange 2003. Some ideas? Thank's and sorry for my bad English! |
|||||||||||||||||||||||