Reputation: 6378
Can i send a pdf file through javascript ?
i have a link ,when i click the link it need to open OUTLOOK with title and the pdf file as attachment.also some body text.
Is it possible ?
Thank you .
Upvotes: 0
Views: 3058
Reputation: 11697
Since adding the PDF as an attachment is not possible, I would recommend putting the link to it in the email body. This will save on the user's bandwidth and can be done with a simple mailto: link.
<a href="mailto:?subject=Look+at+this+PDF&body=http://mysite.com/file.pdf" title="Send PDF">Send PDF</a>
This will also work on any system with whatever email client the user has as their default (i.e. you're not limited to Outlook).
Upvotes: 0
Reputation: 13256
Since it is not possible I suggest gathering all the information you need from your page (subject, body, which file, etc.) and submitting that to your server for processing. On the server you can send your e-mail using smtp.
Upvotes: 1
Reputation: 739
Security restrictions will not allow this. Imagine the potential issues.
Also, you have absolutely no control over which email client is opened. This is set by the user for whatever operating system they are using.
Upvotes: 1