简体   繁体   中英

STMP.js is not sending an email is there something I am doing wrong?

I am trying to send emails from my client-side javascript however the function does not send the email. I do not know what I am doing wrong yet or is the feature disabled from Gmail? Here is my code

function sendEmail() {

      Email.send({
        Host: "smtp.gmail.com",
        Username: "myemail@gmail.com",
        Password: "password",
        To: "recepientemail",
        From: "myemail@gmail.com",
        Subject: "Subject",
        Body: "Hooray",
      })
        .then(function (message) {
          console.log("mail sent successfully")
        });
    
}

您必须在您的 gmail 设置中允许访问不太安全的应用程序(此选项将在 2022 年 5 月 30 日之前可用)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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