Thomas
Thomas

Reputation: 10669

How to format the content of an email send with a form?

I have a complex HTML form which I want to send via email. Is there a way to send and format the content of this email as HTML via javascript without using a server-side script?

Edit: Lets assume there is a smtp server at hand to do the job.

Upvotes: 5

Views: 2659

Answers (3)

Jon
Jon

Reputation: 437554

You can't send email from Javascript, so the obvious answer is no.

However, you can use the user's email client to send the email using the technique described in Sending emails with Javascript. Of course this allows the user opportunity to modify the email before it is sent, and it still requires an email server to accept the message, but it doesn't require you to write code that takes HTTP requests as input and sends email.

Upvotes: 3

Scott C Wilson
Scott C Wilson

Reputation: 20026

Why not just publish the form on your website and send a link?

Upvotes: 0

Ido_f
Ido_f

Reputation: 719

in order to send an email you have to connect to an SMTP server, now this kind of connection you would like to make through the server for few reasons:

  1. you have no idea what kind of firewall does the client has, it might block your ports
  2. to make the client connect to your server you must supply him/it with a user name and password, a thing which you really don't want to do

other then that i do not know if there's a way to do this but i'll be rather surprised to hear of such a thing. good luck

Upvotes: 1

Related Questions