I'm trying to send an email with a HTML body, before i send the mail i want to modify some of the HTML. Basically like you would in jquery, i need to change a few text values inside of divs with certain IDs.
I tried to use https://github.com/jamietre/CsQuery but i dont find any info on ID selectors.
Can someone recommend any other solution?
This is my sendEmail code right now:
public static void sendEmail(String reciverMail, String Subject1, String Body1)
{
if (reciverMail.Contains('@') && reciverMail != "")
{
using (StreamReader reader = File.OpenText(HttpContext.Current.Server.MapPath("~/mail.htm")))
{
SmtpClient client = new SmtpClient();
client.UseDefaultCredentials = false;
client.Credentials = SmtpServerCredentials;
client.Host = SmtpServerAddress;
MailMessage mail = new MailMessage();
mail.From = new MailAddress(SenderAddress, SenderName1);
mail.To.Add(reciverMail);
mail.Subject = Subject1;
mail.IsBodyHtml = true;
mail.BodyEncoding = System.Text.Encoding.UTF8;
//mail.Body = Body1;
mail.Body = reader.ReadToEnd();
try
{
client.Send(mail);
}
catch (SmtpException ex)
{
string aaa = ex.Message;
}
}
}
}
Postalto create your emails, you can have the full power of MVC/Razor for inserting content in the HTML page. You will find you don't need the jQuery approach then.