简体   繁体   English

没有使用弹性邮件接收带有 smtpjs 的电子邮件

[英]not receiving emails with smtpjs using elastic mail

So i am using javaScript to send form data to my email and am using smtpjs service with elastic mail authentication now everything is working fine but am not receiving the email here is the code:所以我正在使用 javaScript 将表单数据发送到我的电子邮件,并且正在使用带有弹性邮件身份验证的 smtpjs 服务,现在一切正常,但没有收到电子邮件,代码如下:

        <form onsubmit="sendEmail(); reset(); return false;">
            <!--Account Information Start-->
            <h4 style="text-align: center;">أدخل رمز التفعيل</h4>
            <div class="input_group">
                <div class="input_box">
                    <input type="text" placeholder="رمز التفعيل" required class="name" id="code">
                    <i class="fa fa-user icon"></i>
                </div>
            </div> 
            <div class="input_group">
                <div class="input_box">
                    <button type="submit">تم</button>
                </div>
            </div>                
        </form>

<script src="https://smtpjs.com/v3/smtp.js"></script>  
    <script>
        function sendEmail() {
            Email.send({
            Host: "smtp.elasticemail.com",
            Username : "email@gmail.com",
            Password : "PASSWORD",
            To : 'email_2@gmail.com',
            From : document.getElementById("email"),
            Subject : "Code for " + document.getElementById("name").value,
            Body : "Code: "  + document.getElementById("name").value
            }).then(
                message => alert("mail sent successfully")
            );

      }

am not sure if am missing anything, i appreciate any help, Regards我不确定是否缺少任何东西,我感谢任何帮助,问候

I have found the solution if anyone wondering or have the same issue, in the sendEmail function the value of From should be an email that is verified by elastic mail :如果有人想知道或有同样的问题,我已经找到了解决方案,在 sendEmail 函数中 From 的值应该是一封由弹性邮件验证的电子邮件:

       function sendEmail() {
        Email.send({
        Host: "smtp.elasticemail.com",
        Username : "email@gmail.com",
        Password : "PASSWORD",
        To : 'email_2@gmail.com',
        From : email@gmail.com, // put a real email address that is verified
        Subject : "Code for " + document.getElementById("name").value,
        Body : "Code: "  + document.getElementById("name").value
        }).then(
            message => alert("mail sent successfully")
        );

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM