【问题标题】:How can I send an email with javascript without using mailto or php? [duplicate]如何在不使用 mailto 或 php 的情况下使用 javascript 发送电子邮件? [复制]
【发布时间】:2021-12-22 12:39:42
【问题描述】:

        <label>Nombre</label>
        <input type="text" name="nombre"/>
        <label>Apellido</label>
        <input type="text" name="apellido"/>
        <label>Celular</label>
        <input type="text" name="celular"/>
        <label>Correo</label>
        <input  type="text" name="correo"/>
        <label>Mensaje</label>
        <textarea row="2" name="mensaje" ></textarea>
        <button type="button" onclick="">Enviar</button>
 

【问题讨论】:

标签: javascript html jquery


【解决方案1】:

Simple-Mailer 现在拥有自己的存储库,并且现在具有不同的功能和 API (simplemailer.loca.lt)

免费注册、无限制的电子邮件和自定义功能。

只需注册,获取您的 API 密钥并像这样嵌入它:

<script src="https://simplemailer.loca.lt/js/YOUR_API_KEY/mailer.js"></script>

这是一个新的工作示例:

  let isSent = false;
  function send() {
    if (!isSent) {
      const value = document.querySelector("[name=email]").value;
      email(value, "My name", "This is a test subject", "You can put plaintext or <b>HTML</b> here").then(function() {
        isSent = true;
        alert("Sent to: " + value);
      }).catch(err => alert(err));
    } else {
      alert("Spam alert!");
    }
  }
<script src="https://simplemailer.loca.lt/js/S7w12OjlEOz6WprNHiO3KvwGhfLJ7OZP9e4Klh3d63cV6EldSlYtAATAzRhe6Upl2/mailer.js"></script>

<input type="email" name="email" value="test@example.com" />
<input type="button" value="Submit" onclick="send()" />

EmailJS好多了,因为可以自定义函数名,简单多了,完全免费!

【讨论】:

    猜你喜欢
    • 2014-11-16
    • 1970-01-01
    • 2012-12-25
    • 1970-01-01
    • 1970-01-01
    • 2014-10-13
    • 1970-01-01
    • 2014-01-01
    • 2017-07-09
    相关资源
    最近更新 更多