Click here to Skip to main content
15,896,526 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear (candidate name),
this is automail we will get back to you soon.
Regards
ABC
Posted

1 solution

Define a constant string for MailBody
C#
public static string MailBody = "Dear [CandidateName], this is automail we will get back to you soon. Regards ABC"

Make a method to replace the candiate name in mail body
C#
public string FormatMailBody(string candidateName)
{
return this.MailBody.Replace("[CandidateName]",candidateName);
}

call this method in a string to get the customized mail body and send that string in mail.
C#
    MailMessage message = new MailMessage(from, to);
message.Subject = "Using the new SMTP client.";
message.Body = FormatMailBody(candidateName);
SmtpClient client = new SmtpClient(server);
client.UseDefaultCredentials = true;
try {
  client.Send(message);
}
catch (Exception) {
}
 
Share this answer
 
Comments
Pratibha cse 27-Nov-15 6:24am    
This is helpful for me, Thanks PANKAJ sir.

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