Convert Html with Base64 to email with cid - c#

We have a tool that gives us html with embedded images as:
data:image/png;base64,1234
We want to have al images extracted and changed to cid images.
Is there a easy way to extract all embedded base64 images and convert them to attachments with cid: tags?
We use MailMessage for the mail message and SmtpClient to send the email.
The problem we have with the embedded images in base64 is that not all mail clients accept this method.

Related

How can I parse the winmail.dat file using TNEF Parsing?

I have inbound mail system using postmark(C# luanguage). Some of the email which was received from outlook service provider contains winmail.dat attachment and facing alignment issue. How to get actual email content attachment from this winmail.dat attachment?
I am tried TNEF parsing using MIME kit. Receiving exception like cannot convert attachment to tnef attachment.

Send a pdf file inside the email's body

I need to incorporate a pdf file inside a string that will be the body of my email, because the structure of my email does not contain attachments.
Can anyone give me any ideas?

attachments with ics file in c#

I am trying to send an ICS (calendar) file to someone that read it using Office365, using C#.
Sending just the ICS works fine. But I have to attach a file.
At this point, the mail is received without calendar, or the calendar is attached to the email and cannot be used, or the attachment is missing.
I tried 2 different ways:
1. send attachment inside VEVENT, using ATTACH;ENCODING=BASE64;VALUE=BINARY;X-FILENAME=file.txt:, but this does not show any attachment in Office365 (like here: Attaching a file to an iCalendar)
2. send attachment as a separate file, and attach it to VEVENT using ATTACH:CID:, but this time the calendar file is displayed as attachment
The second way should work if I can format the mail message to look like this:
multipart/mixed
multipart/alternative
text/plain
text/calendar;method=REQUEST
text/calendar (with a content-disposition:attachment)
(as described in Multipart email with text and calendar: Outlook doesn't recognize ics)
If I send a calendar invite using Outlook365, the message looks like that.(but instead of the calendar as attachment, the image or doc is attached)
but using System.Net.Mail.MailMessage, I can generate a message like this
multipart/mixed
multipart/alternative
text/plain
text/calendar;method=REQUEST
multipart/mixed
text/plain (with a content-disposition:attachment)
Desktop version of Outlook 2007 shows both calendar and attachment, so it seems that Outlook365 is very strict about the format.
But how can I send, using .NET classes, an email that does not have the extra multipart/mixed section? MailMessage class generate for the Attachments collection a new section with content type multipart/mixed, insead of adding them to the top level.

Send HTML code to Body of email application

Is there a way I can use mailto: or JavaScript to send a string containing HTML code to the body of an email message so that the HTML will render? This just renders as text and doesn't actually display an image (same for a mailto: link):
window.open('email#email.com&Subject=Test&Body=<img src="MyImageURL" />');
In the real code, I'm using the full URL of the image, with the http://www..., and also, I confirmed that the email type is HTML and not plain text.
This is a project requirement, to allow someone to send a formatted message through their own email rather than us sending it server-side on their behalf through our SMTP server.
no, there is no way to do this using javascript or mailto. if you wanna read all features to mailto protocol please check this page.

How to c# Embed Base64 Image for Emailing?

I am currently using a string to embed a base64 image in email via EWS but the embeded images is not showing up in my outlook client when i receive the email.
If i save the email source it is viewable in my browser.
static string str = #"<head><meta http-equiv=""Content-Type"" content=""text/html; charset=utf-8"" /></head><body><img src=""data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="" /></body></html>";
Is it possible to embed images into a HTML email message in this method?
Best Regards
Chris
Data URI scheme may be not supported by the receiving party:
What is Data URI support like in major email client software?
Consider using MIME related (cid protocol) to send html email with embedded images. I believe it is far better supported. I'm not sure if it can be easily done with SmtpMail.

Categories