Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
dear to all
i m maiking mail project
now i m want to use attractive mail body
how can i formatting mail body any body give me example
Posted

The answer depends upon many things including your email client.

What I did:

I got a simple HTML editor and created the template for my code including adding the company logo which gave it a more official-looking appearance. In areas where I wanted to have dynamic data I put it in a format such as %username%. It takes a bit of thinking because if you have several areas of independent dynamic data, you have to be able to create independent variables in your code. Next I flip from visual to HTML raw view, copy it and paste it into a text resource in my project.

Finally I grab the resource and I do replaces in it
String.Replace("%username%", user.ToString());


The last part is where you get dependent on the mail client. You have to dig into the API docs to find out how to specify you are sending an HTML body. The rest is a piece of cake. Just format your mail object the same as you always have.
 
Share this answer
 
Comments
ankita-arora 4-Aug-11 13:05pm    
dear sir
can u give a simple example where place an image and other content
pls help
fjdiewornncalwe 4-Aug-11 15:04pm    
+5 from me. Excellent answer. Unfortunately, the OP appears to be resorting to gimme code instead of learning from the excellent solution you have provided.

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