Binary data can't be sent in the body of an email. That's what attachments are for. What are you trying to achieve?
Joined: Jun 19, 2012
whenever user take a deal from my site, i want to send him a mail with pdf file (coupon) in embedded form .......so that he can take print of the mail instead of downloading my attachment.....................this is my requirement......sorry for my bad English............
thanks in advance
Joined: Mar 22, 2005
There is no way to "embed" a document in an email besides making it an attachment. I don't understand what that has to do with what the user does with the document, though. Why wouldn't a user be able to print a document that's sent as an attachment?
If you want to send graphical content embedded in an email, you might have to use HTML email. Basically, its email composed as an HTML page. Most email clients support it now, but the support isn't standard, and some people are vehemently opposed to it. Most email clients will block non textual content in an email from a untrusted sender. The recipient will have to tell the email client that they want to see non textual content. So, your email will most certainly look funky the first time they receive it.
Unless you use embedded resources. Apache Commons Email's HtmlEmail has several embed methods for that. However, that only works for a limited set of resources. As far as I know it only works for images.
Is it even possible to embed PDF files in HTML at all?
I wouldn't even bother and just include the PDF file as a regular attachment.
With the PDF format, your small business can create documents viewable in virtually any operating system or computing platform. Using Adobe Acrobat or other PDF authoring programs, you can create portable documents from any application that supports printing, thus making it an ideal medium for sending letters, contracts, images or just about any other document electronically. In many cases, when you want to send someone a PDF document, you can attach the file to an email just as you would any other type of file. However, if you want the recipient to be able to view the PDF document in the body of the email message as soon as it is opened, many email clients require that the PDF file be embedded as an image. As long as the receiver’s webmail or desktop email client supports images -- and most do -- the reader will see the PDF file when the message is opened.