Generate .msg file for Outlook - javascript

Is there a way to have Javascript/jQuery (or any other web-based language) generate a .msg file that also has an attachment?
I am trying to make it so when a user clicks a button, it downloads a .msg file that has Subject/Body filled out and has a file attached. I know I can just use a long mailto: link but that would not let me attach a file.

You will not be able to pass such content due to both protocol and security measures. Also there is no way to know how each browser is setup to react to the mailto address (Outlook, Webmail, Nothing)..
If you want to send emails with a prefilled subject or content then I suggest you handle it server side with PHP or equivalent language. A great library to consider is SwiftMail
Good Luck

Related

Send files without button event

Is it possible to send files without choosing them with button click and searching folder? I have app written in ReactJS that chooses files on button click, but for testing purposes I need to have 'hardcoded' files so that I don't need to make any actions in my application. The question is: can I do something like that within React app?
First of all, you can't read files from the client computer, even if you have the full path. That would be a major security flaw if javascript could access client files without the explicit consent of the user (provided by the browser).
You can, however, create a file within javascript with hardcode content and send it by http request. Here you have a solution on how to achieve this.

Is there a way to instantly send an e-mail using "mailto" in CSS (or any language-related to web development) without opening Outlook or Apple Mail?

I'm trying to create a personal website that has a contact form -- message box, for example -- but whenever I click submit or send, it opens up my Outlook e-mail, collects all the data I wrote down and then I have to click send again in Outlook to finally deliver that e-mail to someone. I'm new to webDev, so I'm just wondering if it's possible.
mailto: URLs are very unreliable and (when they work) always interact with the mail client on the user's machine.
Any solution involving submitting a form to a web server and sending email using server-side programming won't.
Use a server-side solution. Third-party hosted options exist if you don't want to do any server-side programming yourself.
The way to do this is to use a form to send data to your server. Your server then connects to an SMTP server to send the email.
If web pages could send emails on behalf of people without interaction, this would be used for spam.
It is not possible to directly send email from the web browser, whether it is CSS, HTML, nor Javascript.
I'm assuming that you'd like a contact page which would allow anyone visiting to fill in a small form which notifies you by email when they submit it?
unfortunately, this isn't possible using only css, html or javascript - which are the tools available to you in the web browser.
If you're willing to go a little deeper, then this is entirely possible given a server-side application. It's common to do this kind of thing in PHP, but any server-side language would be able to do this. You would need to do some set-up if you wanted to do it yourself, things like setting up a mail server to send outgoing mail. These things can be tricky. I'm sure that there are also many hosted options available, but I'm afraid I don't know of any.

Convert web information to pdf information

I have an internal form that is web-based. Clients insert their information (Name and such) and sign using a signing pad (This is more than an image. It's the speed, pressure, ect of the signature).
I've got this working as PDF's, but the forms NOW need to be web based, and when the clients hit "save" the information they input is converted to PDF. This must be done server side.
Is there a way to program using HTML, JavaScript, or something else to do this?
Or is there a service that will do it automatically on the server?
Nothing can be saved locally.
(Short summary: information fields on local website, client inserts information to fields, signs using signing pad, and all information is sent to server and converted to PDF)
I'm not too familiar with PHP, but could PHP be used to do this? If so, how?
The reason i can't have it client side, is because we're trying to get the whole system to work on Ipads as well as desktop office computers
There are library to build PDF in PHP, for instance fpdf.
In fact there are many libraries out there which allow you to build pdf, you just have to learn their respective APIĀ a little.
Check out TCPDF. It's the PHP library to generate PDFs automatically.
I used FPDF, it's easy to download and the site contains useful tutorials. Good luck
use dompdf. check this link
From here check my answer on this question. You can download dompdf from here

I need to generate a JSON file in browser using (currently) javascript

I have a website that allows users to select a date range from a data set. At least, that's the goal.
What I would like to have happen: the user selects a date range, presses the submit button, and a script generates a JSON file which MATLAB reads to generate the graphs.
Any thoughts on resources to help accomplish this?
You'll need the script that fires off to be server side. JavaScript is client side and can not, in any way, access, modify, or otherwise create files on the client. You'll have to use a language like PHP to create the file.
Example using PHP:
Once the file is created, force a request on the client side to fire asking for the file. Set the PHP header to Content-Disposition: attachment; filename="< Place file name here>".
This will prompt the browser to launch a download prompt allowing the user to download the file.
Hope this helps.
You can use Downloadify, a small Flash component with a Javascript interface that allows you to create files on the client that a user can download. That's what I used in a similar situation.
You could also try and use Data URI but they are a quite limited and browser specific so some issues may arise.
These may be alternative solutions to the previous answer that suggested using server side code to generate the file.

javascript - send email through outlook

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 .
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.
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.
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.
Send PDF
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).

Categories