Why Join
Become a member
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
C# Corner Home
Technologies
MonthlyLeaders
ASK A QUESTION
Forumguidelines
Pothi Sam
1.7k
282
28.7k
Send HTML Page As Email Body Work But Send Html Background
Jun 26 2015 3:46 AM
I create Smtp Email Send With Html Page As Email Body But body is Html Background Coding.it did't get design
public void sendmessage1()
{
connection();
SqlCommand com = new SqlCommand("YellowMailSend", con);
com.Parameters.AddWithValue("@req_id", Label1.Text.ToString()); ;
com.CommandType = CommandType.StoredProcedure;
sqlda = new SqlDataAdapter(com);
dt.Clear();
sqlda.Fill(dt);
if (dt.Rows.Count > 0)
{
//string filepath = Server.MapPath("MailForm.htm");
string filepath = Server.MapPath("~/MailTest.htm");
StreamReader reader = new StreamReader(filepath);
Message1 = reader.ReadToEnd();
Message1 = Message1.Replace("@Requ", dt.Rows[0]["REQ_ID"].ToString());
MailMessage mailObj = new MailMessage(
lblfrom.Text, lbltocanteen.Text, lblSubject.Text, Message1);
SmtpClient SMTPServer = new SmtpClient("500.500.500.500");
try
{
SMTPServer.Send(mailObj);
}
catch (Exception ex)
{
Label1.Text = ex.ToString();
}
}
html Page Coding MailTest.htm
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link href="StyleSheet.css" rel="stylesheet" type="text/css" />
<title>Mail</title>
<link href="StyleSheet.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="800px" border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse;">
<tr align="center">
<td>VOUCHER REQUEST FOR @Refrence Request id is @Requ</td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
</table>
</body>
</html>
mail is send Successfully but message body like this
Attachment:
mail.rar
Reply
Answers (
3
)
List of site for top-level domain
Out parameter and normal parameter difference?