Can HTML5 be used to send email on the client side?

I want to send an email in HTML5. I don’t want to force the user to open the mail client, I want to send it directly from the web page.

On the side of the note, is there any way to do this in JavaScript? I know that this is probably impossible, just wondering if there are any tricky ways to completely distract him from the client.

+6
javascript html5 email client-side
source share
6 answers

Yes it is possible. But not practical ** See Edit 2

Some HTML5 implementations include web site support, essentially connecting tcp to a server. Add some send / recv code and you can create an SMTP client.

In fact, it looks like nodejs and websocket support were used to implement the smtp client ... see here ...

You still need the smtp server, username, password, etc., like a regular smtp client for it to work.

Using this method for spamming would be unlikely, as your smtp provider could easily cancel your account.

=== EDIT ===

In fact, you could build a version with fewer servers, it would also have to search the name server to find the mx entries. However, there is a possibility that any decent SMTP servers will support spam-list blacklist tables, and connecting from a random IP address will see a message that is usually marked as spam.

Also talking to smtp servers that require secure mail connections can be tricky.

As already mentioned, there are malicious uses in this implementation, such as sending spam. Perhaps you can probably be the creator of the HTML5 botnet, but I would think that you already know about it :)

=== EDIT 2 ===

As mentioned in Mark At Ramp51, manual contact with web slots is required. That was what I did not know about. You will have to hack the websocket implementation to get around the handshake.

The correct way is to send the web server by email.

+7
source share

In short, NO is not directly from the client (excluding hacks).

you can make an ajax call to your server and send an email.

the problem with doing this with a client, rather than using an email client, is complex. For example, most Internet service providers have their own SMTP relay, through which all outgoing mail must be sent to port 25. You will have problems getting the necessary information for this. Secondly, the web browser does not understand the SMTP protocol and does not have an XMLHttpRequest object.

So, if you are a hacker ninja, you may be able to understand something using ActiveX, Java applets or flash memory, but you will basically have to work directly using the tcp socket and issue SMTP protocol commands through this socket.

There are many obstacles to overcome, in fact I do not know how to do this, but where there is, there is a way. Do not be surprised that if you find a hack, it can be quickly connected by major browser providers.

+12
source share

It's impossible.

Instead, you should use AJAX to send email to the server.

+3
source share

You cannot send an email using JavaScript only. You will need some form of server-side processing (PHP, ASP, etc.) to send the actual email message.

There is a good tutorial on setting up ajax form here: http://net.tutsplus.com/tutorials/javascript-ajax/submit-a-form-without-page-refresh-using-jquery/

It does not include PHP (or ASP, etc.) for sending email, but there are many tutorials for sending email using PHP.

+1
source share

You cannot do this exclusively with client-side code.

You can do this with an AJAX server callback.

0
source share

Send email directly from Javascript

From the official resource:

How it works?

  • Connect Email Service Choose from a wide range of email services. We support both (Mailgun, Mailjet, Mandrill, SendGrid, Amazon SES and Postmark) and personal mail services (AOL, Gmail, FastMail, iCloud, Mail.ru, Outlook, Yahoo, Yandex and Zoho).

  • Creating Email Templates Choose from our list of templates or easily create your own. Templates are parameterized, so you can further customize them using Javascript.

  • Send an email using our Javascript API Add our Javscript SDK and start sending emails!

Here's what a regular call looks like:

var service_id = 'my_mandrill'; var template_id = 'feedback'; var template_params = { name: 'John', reply_email: ' john@doe.com ', message: 'This is awesome!' }; emailjs.send(service_id,template_id,template_params); 

All existing APIs require the use of a secret key, which, obviously, you would not want to use in your interface code. The specified service overcomes this by allowing you to send only predefined templates, so for the function "Share with a friend" you create a template called "share".

-2
source share

All Articles