Hi Experts,
I am using asp.
net 3.5 and C#.
I want to send mail from asp.
net, for that I have got some details from my hosting provider
which are these:
mail.MySite.
net
UserName
Password
But I am unable to send mail through these details, I have done the following changes in my web.config file:
<system.net>
<mailSettings>
<smtp>
<network
host="mail.MySite.
net"
port="8080"
userName="UserName"
password="Password" />
</smtp>
</mailSettings>
</system.net>
Also, at the code behind I am writing this function:
MailMessage mail = new MailMessage("webmaster@mySite.
net", "
[email protected]");
mail.Subject = "Hi";
mail.Body = "Test Mail from ASP.
NET";
mail.IsBodyHtml = false;
SmtpClient smp = new SmtpClient();
smp.Send(mail);
but I am getting error message as message sending failed.
Please let me know what I am doing wrong and what I have to do to make it work fine.
Thanks in advance.