开发者

Issue with SMTP relay in .NET

Perhaps this is more of an IIS question than programming, but I'll throw it out there nonetheless.

I am attempting to send an email via SMTP with C# using the following test code:

//params: from email, to email, subject, body
MailMessa开发者_JAVA百科ge m = new MailMessage( <sendemail>, <receiveemail>, "testsubject", "Testbody" );

SmtpClient c = new SmtpClient( <SMTP Server> );

c.Send( m );

Extremely simple. I am avoiding credentials entirely because of the configuration on my SMTP server:

alt text http://img683.imageshack.us/img683/8909/smtp1.png

This should allow me to connect without credentials. Alternatively I've tried empty strings for username/password, and default credentials.

When I send attempt to send, I get the "Sending SMTP Email to failed with the following error: Mailbox unavailable. The server response was: 5.7.1 Unable to relay for " Error. I go to the relay section of IIS, and it is as follows:

alt text http://img192.imageshack.us/img192/5002/smtp2.png

So my thought is even though the "Allow all computers which successfully authenticate to relay" option is enabled, since I allow anonymous authentication my application is not able to relay. Is this the case? If so, how do I go about fixing my code to be able to relay? I've tried messages to emails inside and outside of the domain, to no avail. This is a server 2003 machine.


Your assessment is correct.

You can either switch to using authenticated connections, or else add all of the IP's/Domains that your code will run from to the relay exceptions list.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜