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?
Related
I'm currently sending reply emails via SMTP using SendGrid to emails I receive. I save the emails I get as .msg and load them as MimeMessage. I add some text as a reply but if the emails have images, the images don't seem to get passed through and I'm not sure exactly where they are. My goal is to send the reply emails with images being retained as currently they show as blank boxes in Outlook saying 'The linked image cannot be displayed. The file may have been moved, renamed, or deleted'.
From my research, I am seeing that images are passed in through attachments and the body of the email show the image as cid:image001.png... . I can't find where the actual images are stored though. When I look into the MimeMessage, attachment is null (unless I attach a file to the email, that file will show but not images within a body of email)
Does anyone have any tips for where to look for the image(s) of emails?
Update: I found the image stored in Body Parts. Will figure out how to pass that one to the reply next.
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.
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.
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.
I have a csv file as an attachment to the inbox.
They should be able to view the attachment when they click on the link, but how do I display them the csv attachments??! the browser just parses it and displays the content instead of poping the open/save window.
anyone had to open a csv file as an attachment on web before? thanks.
Response.AddHeader "content-disposition","attachment; filename=myfile.csv"
Adding this header to your response will cause the browser to treat the content as an attachment and display the 'File Download' dialog instead of attempting to display the content in the web page.