PDA

View Full Version : ASP.NET Send email


ghell
06-08-2006, 11:45 PM
I'm using the smtp server that ships with windows server 2003 on the same machine as the asp.net iis is running from. I am using the following code:Mailer = new System.Net.Mail.SmtpClient("mydomainname.com"); // for some reason i couldnt leave this blank, i dont know if i could have put localhost instead.
Mailer.Send(from, to, subject, body);and this sends fine to email accounts on that server (that have the same domain name as the argument in SmtpClient's constructor at least) but when i try to send mail to any external email addresses such as gmail.com or hotmail.co.uk it just saysMailbox unavailable. The server response was: 5.7.1 Unable to relay for someemail@hotmail.co.uk (it shows the valid "to" email address in the error but for obvious reasons im not putting it straight here)

pop clients have to be set up to use secure password authentication if that helps but im not using any login stuff on this page at all (dont know if thats why it wasnt working)

this is a migration of a worknig asp3 page which used cdosys. for cdosys i had to put a password etc in but this seems to work for local email addresses so i dont know if i still do... the error doesnt suggest something about authentication but i dont know if it is or not.

does anyone have any suggestions? :o