Hi in my website, i am using email feature for registration where password is going to be send by email.
I am using following code
using System.Net.Mail;
MailMessage objMsg = new MailMessage();
objMsg.IsBodyHtml = false;
objMsg.From = new MailAddress(ConfigurationManager.AppSettings["AdminMailID"].ToString());
objMsg.To.Add(new MailAddress(txtEmail.Text.Trim()));
objMsg.Subject = "Your registration information.";
string emailFormat = Resources.MasterResource.emailformat.ToString();
emailFormat = emailFormat.Replace("USERNAME", txtName.Text);
emailFormat = emailFormat.Replace("pUNAME", txtLoginID.Text.Trim().ToLower());
emailFormat = emailFormat.Replace("pPASSWORD", password);
emailFormat = emailFormat.Replace("pConsumerNumber", txtConsumerNumber.Text.Trim().ToLower());
emailFormat = emailFormat.Replace("pConsumerName", txtName.Text.Trim());
objMsg.Body = emailFormat;
SmtpClient objSmtpClient = new SmtpClient(ConfigurationManager.AppSettings["SmtpServer"].ToString(), 25);
objSmtpClient.Credentials = new System.Net.NetworkCredential(ConfigurationManager.AppSettings["SmtpServerAuthenticatePassword"].ToString(), ConfigurationManager.AppSettings["SmtpServerAuthenticateUser"].ToString());
try
{
objSmtpClient.Send(objMsg);
}
catch (Exception ex)
{
throw new Exception(GetLocalResourceObject("SMTPError").ToString());
}
finally
{ }
According to above code, following are the key points 1. Email format is text not HTML 2. The body of mail is placed inside globalresourse file
Problem area
1. There are paragraph implemented in mail body How it happens in text format.
2. My mail body have break line
how can i implement in text format
Please help?
[Edit] How can we write hyperlink inside text mail.
Important point is that i have written mail body inside master resource file? I not getting how can we write character for above mentioned points