Click here to Skip to main content
16,020,347 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Actually in that bracket am only typed automatically that "smtp" defaultly doesnt come so my mail also not going please help me.



SmtpClient MailClient = new SmtpClient("smtp.gmail.com",465);

MailClient.Credentials = new System.Net.NetworkCredential("jothi.rjk05@gmail.com","Password");
MailClient.Send(Emailmsg);
Posted

1 solution

C#
//sending Email.
System.Net.Mail.MailMessage msg = new System.Net.Mail.MailMessage();
                msg.To.Add(TextBox1.Text);//Read user email id here for which u have to send email
                msg.Subject = "Forgot password.";
                msg.From = new System.Net.Mail.MailAddress("autoemail@xyz.com");
               
                msg.Body += "Have a great day!\n"; // Add email body as u like.
                msg.Body += "  \n  ";
                msg.Body += "-Team\n XYZ services!";
 
                System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("localhost");//replace the localhost with hosting server name.For example in case of godaddy it is "relay-hosting.secureserver.net"
                smtp.Send(msg);


Try this!!
 
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