Mayur Gujrathi

Mayur Gujrathi

  • NA
  • 119
  • 403.3k

About Sending mails

Feb 3 2011 6:01 AM
Dear experts I am sending mails in following way but when i  use  mail address other than gmail address in txtemail then it gets problem please give me one stop solution. in txtpass user have to give its correct password.


SmtpClient serverobj = new SmtpClient();
                serverobj.Credentials = new NetworkCredential(txtemail.Text,txtepass.Text);
                serverobj.Port = 25;
                serverobj.Host = "smtp.gmail.com";
                serverobj.EnableSsl = true;
                MailMessage msgobj = new MailMessage();
                msgobj.From = new MailAddress(txtemail.Text, "Click On Following Link To confirm Registration", System.Text.Encoding.UTF8);
                msgobj.To.Add("[email protected]");
                msgobj.Subject = ("Confirm your registration");
                msgobj.Body = "http://localhost:1330/activationpage.aspx?username=" + txtuname.Text;

             
                msgobj.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;
                serverobj.Send(msgobj);
                Response.Write("We have send a link on your mail please Confirm your registration by clicking on it");

Answers (6)