Click here to Skip to main content
15,896,387 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Please help me in solving this problem.



i am using the following code : to send the conformation link to registered customer.
Code Look like this:

MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");
mail.From = new MailAddress("MyInfo@gmail.com");
mail.To.Add(Email);
mail.Subject = "InsideVizag";
mail.IsBodyHtml = true;
mail.Body = "Hello,

I know you keep forgetting things, but loosing my information makes me feel a little sad .
This shows we lost touch from many days.
Anyways, I am thrilled and happy to see you back and would love to reveal them for you now.

Password:" + Password;
//mail.Attachments.Add(new Attachment(textBox3.Text));
SmtpServer.Port = 587;
SmtpServer.Credentials = new
System.Net.NetworkCredential("MyInfo", "MyInfo9$");
SmtpServer.EnableSsl = false;
SmtpServer.Send(mail);



its is working fine in Local System...but problem arise when it is hosted in my Hosting Server .. it is not working and not even giving any error..

Plz help me in solving this issue..i thank for them in advance..
Posted

You will have to use the SMTP server name and credentials provided by your hosting service provider.
 
Share this answer
 
Comments
Rajesh Yerramsetti 7-Jul-12 3:04am    
i used smtp and credentials
bbirajdar 7-Jul-12 7:34am    
Since the email is working locally and not on the hosted server, the problem is not with your code. Check the SMTP credentials, server name and the ports.
You defined:
C#
System.Net.NetworkCredential("MyInfo", "MyInfo9$");


This might work in local environment but that's not the correct way to provide credentials, try these:
Either do:
C#
SmtpServer.Credentials = new System.Net.NetworkCredential("MyInfo", "MyInfo9$");

OR
Configured SMTP configuration in Web.Config:
<system.net>
   <mailSettings>
     <smtp from="abc@somedomain.com">
       <network host="somesmtpserver" port="587" userName="MyInfo" password="MyInfo9$" defaultCredentials="true" />
     </smtp>
   </mailSettings>
</system.net>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900