That looks like my code.... Where did you get it from? Anyways yes you did miss something. In your case you're initializing the username and password to null which will fail authentication with the server so you should just use the default credentials.
By the way -- You should never turn on anonymous relaying. You should create a user on your mailserver for the application.
Also please use code tags when posting code on daniweb:
[code=csharp]
...code here...
[/code]
sknake
Industrious Poster
4,954 posts since Feb 2009
Reputation Points: 1,764
Solved Threads: 735
Let me ask you this -- What do you want to do? Enabling relay on the mailserver is a bad idea, you should really use authentication. If you want to use anonymous relay then remove all of the user/pass/credential related code.
If you want to make a good decision ;) and use authentication then set up a user on your server and let me know and i'll post modified code
sknake
Industrious Poster
4,954 posts since Feb 2009
Reputation Points: 1,764
Solved Threads: 735
Try this and tell me if it works:
public static void SendMailQ(MailMessage Message)
{
SmtpClient cli = new SmtpClient("172.16.252.8");
cli.UseDefaultCredentials = false;
cli.Credentials = null;
cli.Send(Message);
}
sknake
Industrious Poster
4,954 posts since Feb 2009
Reputation Points: 1,764
Solved Threads: 735
Wait a minute here... You say it works on someone elses PC? Are you running your application from the other persons PC? You can allow "10.1.1.5" to relay anonymously but require everyone else to authenticate. There are a number of ways to punch holes in the security.
In order to test this you will have to run the application from the same PC as the current application.
sknake
Industrious Poster
4,954 posts since Feb 2009
Reputation Points: 1,764
Solved Threads: 735
Did you try running the application off of his machine? Just because you use the same mailserver does not mean the mailserver treats you both equally.
Get Wireshark and see how he is authenticating versus how you are authenticating and you will know what the difference is.
sknake
Industrious Poster
4,954 posts since Feb 2009
Reputation Points: 1,764
Solved Threads: 735
wot is the error u getting...could u please elaborate ..?
dnanetwork
Practically a Master Poster
633 posts since May 2008
Reputation Points: 28
Solved Threads: 106