I want to conert the mail document and attachments to pdf,
If there’s any text in the mail body along with the attachment then the mail content should be converted to pdf in the first page of the pdf, followed by the attachment (in the next page/s).
I am able to convert the mail body and attachment into seperate pdf's but not able to club them, in mail body as first page of pdf and attachments as other.
Please help.
Related
I'm using Microsoft.Exchange.WebServices.dll to read signed emails from an Exchange Server. Returned object's property Attachments contains either regular attachments or inline images from the email body.
In case the email has both (regular attachments, body with inline images), only regular attachments are listed in the Attachments. Inline images are completely missing.
Any idea on how to retrieve both, regular attachments as well as inline images in the body? Body property of the email has just the text part and no mention/reference there should be some images at all.
I am creating an HTML email, and would like to add a table of contents which shows hyperlinks to items in the email. My currently workflow is simply generating the complete HTML file and then displaying that HTML file within the HTMLBody of an Outlook mail item.
When I open the HTML page in a browser, it works fine. But when I set the Outlook mail HTMLBody equal to that text, the bookmarks no longer work.
The bookmark hyperlinks look akin to:
<a href = "#item" ...>Blah<\a>
Where an item in the HTML has the name and id attributes equal to "item"
How do I get the bookmarks to work?
Please set the email type to html.. something like this..
// Set the format of the mail message body as HTML
mMailMessage.IsBodyHtml = IsBodyHtml;
With Outlook 2010, it helped me, when i use <a name="item"></a> as a bookmark. i.e. exactly "A" item.
I am using the Grails mail plugin to send emails and I want to send images in the body of the email, not as attachment. What I want is for images to be shown in the email body itself, as in newsletters. I tried:
img style="display:block; height:100px; width:100; " alt="candle"
src="http://www.xyz.com//Candle_4.jpg">
but it is being displayed as-is.
I also tried using the wikimedia format:
[[:File:Example.jpg]]<br/>
[[Special:FilePath/Example.jpg]]
but again, both seem to link to external.
What am I doing wrong?
This is the email template I am using:
<img src="cid:springsourceInlineImage" /> Dear [username],<br/>
Thank you for shopping with us.<br/>
You have placed a new order with following details.<br/>
[details]<br/>
Happy shopping!
But, if I want to put 10 images in my template, how would I do that?
You have to do three things
Declare mail as multipart
Attach your image as inline image
Reference you inline image from your mail template
According to this mailing list thread it should work like this:
sendMail{
multipart true
to "[hidden email]"
subject "Subject goes here"
html g.render( template: '/emails/mailTemplate')
inline 'springsourceInlineImage', 'image/jpg', new File('./web-app/images/springsource.png')
}
In your template you could refer the image like this
<img src="cid:springsourceInlineImage" />
Hope that helps.
In general, most "newsletter" type emails are just HTML emails and don't in-line the images within the body of the emails. In fact, many email servers will outright reject emails that are too big, and putting the image data inside the body of the email can easily run this risk.
Instead, the way to do with this is to just have HTML emails with the images you wish to include as normal HTML image links.
Please refer to the Mail plugin documentation for more info on how to send HTML emails.
Sorry I don't have enough Stackoverflow points to leave comment on others' answers.
In #aiolos 's answer, it contains:
inline 'springsourceInlineImage', 'image/jpg', new File('./web-app/images/springsource.png')
This specifies 'image/jpg' as the output, but the file is in png format. Is this intentional?
Wikipedia provides a list of mime types: http://en.wikipedia.org/wiki/Internet_media_type#Type_image
I tried 'image/png' and it worked, so I'm not sure if setting it to 'image/jpg' makes any difference.
i have some data in text format and i want to convert that data to pdf format and then attatch to mail..
i dont want to open that pdf in app...
My program uses MAPI for working with Exchange mailboxes. The problem is if a user fires up Outlook, adds a file as an attachment and also opens Paint, selects a region there, copies it into clipboard and pastes into the message body the resulting message showns two attachments.
More specifically, the program calls IMAPIMessage::GetAttachmentsTable() to retrieve the attachments table and that table contains two objects. Is there a way a program can decide whether the "attachment" is really an attached file or a portion of inline content?
You will need to check whether the HTML body (through the img tag) refers to the attachment, either through img:cid and PT_ATTACH_CONENTS_ID property or though the file name (PR_ATTACH_LONG_FILENAME) or contnet location (PR_ATTACH_COMTENT_LOCATION).
The property you are looking for is PR_RENDERING_POSITION (0x370B0003). A -1 means that the attachment is a "normal" attachment and not in-line. If the value is anything other than -1, then that indicates an in-line attachment and the value is the position in the body that the attachment should be rendered at.
Here is the MSDN page describing it.
EDIT:
Dmitry, I do not agree with your comment. I have HTML email messages with in-line attachments and the PR_RENDERING_POSITION is working as described in the MSDN page I posted.