Sending Mail with Image as background

Posted by Nagasundar_Tn under C# on 8/28/2012 | Points: 10 | Views : 6248 | Status : [Member] | Replies : 2
Hi Experts,

I would like to send mail from C# using System.Mail namespace with image background. How I can use LinkedResources class to obtain my scenario? Any coding help would be better for me.

Regards,
T.N.Nagasundar



Responses

Posted by: Vuyiswamb on: 8/28/2012 [Member] [MVP] [Administrator] NotApplicable | Points: 25

Up
0
Down
What have you done so far , can we see your code ?

Thank you for posting at Dotnetfunda
[Administrator]

Nagasundar_Tn, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nagasundar_Tn on: 8/29/2012 [Member] Starter | Points: 25

Up
0
Down
Hi

The following is the code snippet which I have done. Actually I am getting the image as attachment but not as background image. How can i achieve this?

        AlternateView objAlternateView;

string strServerPath = Server.MapPath("images\\");
LinkedResource imgtestLogo = new LinkedResource(strServerPath + "testlogo.gif");

strBody += "<table width='100%'><tr align='center'>";
strBody += "<td align='left'><img id='logo' src='cid:imgtestLogo' alt='' />Checking</td>
strBody += "</tr></table>";


objAlternateView = AlternateView.CreateAlternateViewFromString("<BR>" + strBody + "<BR>", null, "text/html");
imgtestLogo.ContentId = "imgtestLogo";
objAlternateView.LinkedResources.Add(imgtestLogo);

// For sending the mail

string strMailServer;
MailMessage objMail = null;
objMail = new MailMessage();
objMail.From = new MailAddress("From Mail");


objMail.To.Add("To Mail");


objMail.Subject = "Subject";
objMail.AlternateViews.Add(objAlternateView);

objMail.Priority = MailPriority.Normal;
SmtpClient objclient = new SmtpClient(MailServerAddress);

objclient.Send(objMail);


Regards,
T.N.Nagasundar

Nagasundar_Tn, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response