Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i send emails without a server ? Only front-end Javascript with sendgrid or

i was wondering lately how i could send emails with only a front-end language like Javascript through Email as a Service apps like sendgrid or mandrill or so.

Sendgrid and mandrill have Curl APIS, so basically i can just do an AJAX post request to their API to send a mail but the thing is, i will have to put my API secret key in the JS file, this means it will be public... while it's supposed to be secret.

On those two apps, there's nothing in the docs concerning front-end use except having your own server which will use the API, but i'm currently on front-end based project. No server programming, the server only renders the assets that's all.

Do you guys know any method or apps of this kind to acheive this ? Thanks

like image 702
darkylmnx Avatar asked Aug 17 '15 00:08

darkylmnx


People also ask

Can you send an email without a server?

The simplest way to send a message is to use QuickSend method of Smtp class (this method is static, it does not require you to create an instance of Smtp class). QuickSend method allows you to send e-mails out even if you do not have an SMTP relay server.

Can you send email without backend?

There are a few ways to send an email from your react application. This article will look at two of those methods: using the mailto HTML attribute, and using EmailJS. These methods will both work for frontend-only applications that are not supported by a backend server. Don't reinvent the wheel.

Can you use JavaScript to send an email?

Can I send emails with JS or not? You can't send emails using JavaScript code alone due to lack of support for server sockets. For this, you need a server-side language that talks to the SMTP server. You can use JS in conjunction with a server script that will send emails from the browser based on your requests.

How do I send an email using JavaScript in SendGrid?

If you have a SendGrid account and an API key set as an environment variable, here is all the code you need to send an email in JavaScript: const sgMail = require ( '@sendgrid/mail'); sgMail. setApiKey ( process. env.

Is it possible to send an e-mail using JavaScript?

Even if it was possible to send e-mails directly using JavaScript (that is from users computer), the user would still have to connect to some SMTP server (like gmail.com), provide SMTP credentials, etc. This is normally handled on the server-side (in your application), which knows these credentials.

Is it possible to send emails with Node JS?

When the name JavaScript is used in the context of sending emails, Node.js is the first thing that comes to mind. We even blogged about how to send emails with Node.js. In this article, we want to change the perspective from the server-side to the client-side. Let’s figure out how you can use JS to send emails from the app that has no back-end.

How do I send an email using the Twilio SendGrid API?

The Twilio SendGrid API for sending email is a great solution to this problem. If you have a SendGrid account and an API key set as an environment variable, here is all the code you need to send an email in JavaScript: const sgMail = require ( '@sendgrid/mail'); sgMail. setApiKey ( process. env.


3 Answers

You can use FormSpree. Just provide the url in form action.

https://formspree.io/

like image 110
Avik Avatar answered Sep 27 '22 21:09

Avik


Several suugestions

  • dropbox forms via jotbox includes encryption and a paid SSL option
  • sendgrid using parse cloud instructions
  • third party service, eg 123contactform
  • use a not-so-secure php form with extra javascript to mask the email address, see responses on this thread including Dave Jarvis' php code
like image 45
Mousey Avatar answered Sep 27 '22 19:09

Mousey


You could use a serverless architecture with AWS Lambda functions written in JavaScript.

like image 31
M3RS Avatar answered Sep 27 '22 19:09

M3RS