Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to add images?
Message
From
23/01/2023 09:38:10
 
 
To
22/01/2023 14:17:18
General information
Forum:
HTML5
Category:
HTML
Miscellaneous
Thread ID:
01685888
Message ID:
01685892
Views:
36
>Hello all,
>
>I know I can add CSS directly into an HTML page.
>
>I have to send emails and I would like to make them prettier.
>
>How do I add images directly in my HTML + CSS?
>
>Regards

I have some C# code that does this, here's a cut and paste of the relevant parts:
LinkedResource imageResource = new LinkedResource(logo, "image/jpeg");
 imageResource.ContentId = "mylogo";
 imageResource.TransferEncoding = TransferEncoding.Base64;               
FileInfo logoFile = new FileInfo(logo);

SmtpClient client = new SmtpClient(smtpClient, smtpPortInt);
MailMessage msg = new MailMessage();
msg.To.Add(emailAddress);
msg.Subject = "My subject";
string Body = "<img alt="My Logo" hspace=0 src="cid:mylogo" align=baseline border=0 >
<br />
<h1>IMPORTANT NOTICE</h1>"
AlternateView htmlView = AlternateView.CreateAlternateViewFromString(Body, null, "text/html");
htmlView.LinkedResources.Add(imageResource);
msg.AlternateViews.Add(htmlView);
Frank.

Frank Cazabon
Samaan Systems Ltd.
www.samaansystems.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform