C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » .NET »

send email html format with image also


Posted Date: 29 Nov 2008      Posted By: santhosh      Member Level: Bronze     Points: 1   Responses: 2



i want to send the email html format with image. i am using C#.net windows application. And also preview the mail before send the mail. anyone can tell me how it is possible to send the mail.

MailMessage emailMesg = new MailMessage();
emailMesg.From = fromid;
emailMesg.To = toid;
string img = "C:/Documents and Settings/Administrator/Desktop/sample.jpg";
emailMesg.Subject = txtTitle.Text;
strHtml = ("<HTML><HEAD><TITLE>" + txtTitle.Text + "</TITLE></HEAD><BODY bgcolor=AliceBlue><br> <img src=" + img +
+ "<font face=\'Arial\' size=\'2\' color=black> " + txtDescription.Text + "',<br><br><br>Thanking you.....</font>"
+ "</p></BODY></HTML>");

//<HEAD><TITLE>"+txtTitle.Text +"</TITLE></HEAD><BODY bgcolor=" + ("White" + "><p><font face=\'Arial\' size=\'2\' color=Blue>Dear '" + txtDescription.Text + "',<br><br><br>Your Password is below <br><br> <br>User Name: '" + "username" + "'<br><br> <br>Password: '" + "password" + "' <br><br>Thanking you.....</font></p></BODY></HTML>"));

emailMesg.Body = strHtml;
emailMesg.BodyFormat = MailFormat.Html;
emailMesg.Priority = MailPriority.High;
// emailMesg.BodyEncoding = Encoding.Unicode;

try
{
SmtpMail.Send(emailMesg);
}
catch (Exception ex)
{
MessageBox.Show("ex.Message.ToString()");
}

I am using this code. but i could not send with image.





Responses

Author: saravanan    29 Nov 2008Member Level: SilverRating: 2 out of 52 out of 5     Points: 4

Hi, we need to send the image as attachment to the email and give the attachment path to the html, currently you have set the local path of the image which will not be available when it goes to web, so you need to try either by uploading the image on web and assign the path of the image or by attaching the image as attachment to the mail.

hope this will solve ur issue.

thanks
saravanan



Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.


Next : send email html format with image
Previous : How to convert Project
Return to Discussion Forum
Post New Message
Category: .NET

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use