Plzz check this code and tell me where i am going wrong.. Code given below:
public void sendemail( string email)
{
string EMAILID = email;
string EMAILBODY;
MailMessage objemail = new MailMessage();
objemail.To.Add(new MailAddress(email));
objemail.From = new MailAddress("[email protected]");
objemail.Subject = "Password recovery";
EMAILBODY = "";
EMAILBODY += "";
EMAILBODY += "
| User Credentials: | |
| User: | ";"+userid+" |
| Click the link to reset your password: | ";Reset password |
EMAILBODY = "";
objemail.Body = EMAILBODY;
objemail.Priority = MailPriority.High;
objemail.IsBodyHtml = true;
SmtpClient smtpmail = new SmtpClient();
smtpmail.Send(objemail);
}
Pankaj GogoiPosted Jun 18, 2011, 5:09 AM
here smtpserver is the mail server IP name.
One more thing I would suggest is that you use stringbuilder class instead of string for emailbody. Strings are immutable.
StringBuilder is better when you have to format and concatenate a string more than five times.
Thank You
Suthish NairPosted Jun 17, 2011, 9:18 AM
Ish BandhuPosted Jun 17, 2011, 3:09 AM