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

落爺英雄遲暮 提交于 2019-12-04 10:25:09

问题


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


回答1:


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

https://formspree.io/




回答2:


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



回答3:


An alternative is to let each user use his or her own outgoing mail server, by using a mailto: link, which allows you to specify the header information and also a quasi-header named “body”, which puts the content you want into the message body.




回答4:


If you'd like to keep the key secure you can use something like Aerobatic's HTTP Proxy to specify the key and proxy through the server environment.



来源:https://stackoverflow.com/questions/32041229/how-can-i-send-emails-without-a-server-only-front-end-javascript-with-sendgrid

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!