I have been at odds with our network guy over an application that is designed
to send alert emails to accounts outside of our domain to users. The issue is
the mail server is not set for "open relay" so any Mail.Send() that is to an
account outside of our domain server gets rejected by the SMTP. Any accounts
inside the domain get sent properly.
System.Web.HttpException: Could not access 'CDO.Message' object. --->
System.Reflection.TargetInvocationException: Exception has been thrown by the
target of an invocation. ---> System.Runtime.InteropServices.COMException
(0x8004020F): The server rejected one or more recipient addresses. The server
response was: 550 5.7.1 Unable to relay for my*******@otherdomain.com
My network guy says the relay should be necessary as long as I am
authenticating to the SMTP. But the there lies the problem, I am
authenticating: (obviously I’ve changed the parameters values here for
security reasons)
MailMessage mailMsg = new MailMessage();
SmtpMail.SmtpServer="mail.ourdomain.com";
mailMsg.Fields["http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"] ="1";
mailMsg.Fields["http://schemas.microsoft.com/cdo/configuration/sendusername"] ="domain/username";
mailMsg.Fields["http://schemas.microsoft.com/cdo/configuration/sendpassword"] ="password";
So what should I be doing in this situation? I understand that open relay is
what spammers can typically use. I am passing the authentication to the
server so why is .NET telling me that it can’t relay the message outside of
our domain? Can you sent relay on a specific account?
--
JP
..NET Software Developer