简体   繁体   English

邮箱发送JS SMTP

[英]E-mail sending JS SMTP

firstly it's sending emails and it's work properly but the problem is with ' Body '.首先,它正在发送电子邮件并且工作正常,但问题出在“ Body ”上。 It's doesn't take values from inputs.它不从输入中获取值。
The sended message look like this:发送的消息如下所示:

Name:名称:
Email: Email:
Message:信息:

Example from html:来自 html 的示例:

<input type="text" id="name" placeholder="First Name"><br>

And js:和js:

const nameInput = document.querySelector('#name');
const emailInput = document.querySelector('#email');
const messageInput = document.querySelector('#message');

       // Send email
    const sendEmail = () => {
        Email.send({
            Host: "smtp.gmail.com",
            Username: "email@gmail.com",
            Password: "email",
            To: 'email2@gmail.com',
            From: 'email@gmail.com',
            Subject: "New email from website",
            Body: "Name: " + nameInput.value + "<br>Email: " + emailInput.value + " <br>Message: " + messageInput.value
        }).then(
            message => alert(message)
        );
    }

What im doing wrong?我做错了什么?

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

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