Description:
HTML Page:
Aspx.CS:
In this
example we explain that how to send HTML Page as Email Body in Asp.Net using C#.
or how to send HTML page as email body in asp.net. or send html file or page as
email body in asp.net using C#. or dynamically send html file or page as email
body in asp.net using C#.
Here we demonstrate
that how to send email with HTML Template in Asp.Net using C#. or dynamically
set email body as Email Template using HTML page in Asp.Net using C#. or how to
send email with HTML body format in asp.net using C#.
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Send HTML
Page (File) as Email Body in ASP.Net using C# and VB.Net</title>
</head>
<body>
<img src="//http://aspsolutionkirit.blogspot.com/images/Logo.png"
/><br />
<br />
<div style="border-top: 3px solid #22BCE5">
</div>
<span style="font-family: Arial; font-size: 10pt">Hello <b>{UserName}</b>,<br />
<a style="color: #22BCE5" href="{Url}">{Title}</a><br />
{Description}
<br />
<br />
Thanks<br />
AspSolutionkirit Team </span>
</body>
</html>
private string PopulateBody(string userName, string
title, string url, string
description)
{
string
body = string.Empty;
using
(StreamReader reader = new
StreamReader(Server.MapPath("~/EmailTemplate.htm")))
{
body = reader.ReadToEnd();
}
body = body.Replace("{UserName}", userName);
body = body.Replace("{Title}", title);
body = body.Replace("{Url}", url);
body = body.Replace("{Description}", description);
return
body;
}
0 comments:
Post a Comment