Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to add images?
Message
De
23/01/2023 09:38:10
 
 
À
22/01/2023 14:17:18
Information générale
Forum:
HTML5
Catégorie:
HTML
Divers
Thread ID:
01685888
Message ID:
01685892
Vues:
37
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform