首页 > 解决方案 > 如何使用 emailjs 将电子邮件发送到收件箱,每次电子邮件登陆到垃圾邮件

问题描述

下面是我用来使用 emailjs npm 发送电子邮件的代码,但它总是登陆垃圾邮件。帮我写一个代码,它总是会向收件箱发送电子邮件

 var email = require('emailjs');
 var server     = email.server.connect({
 user:  "no-reply@domain.com", 
 password:"password", 
 host:  "mailserver", 
 ssl: true
 });

 var message    = {
 text:  "i hope this works", 
 from:  "Company Name <no-reply@domain.com>", 
 to:        "someone <username@gmail.com>",
 subject:   "testing emailjs",

 attachment: 
 [
   {data:"<html>i <i>hope</i> this works!</html>", 
 alternative:true}
  ]
  };

  // send the message and get a callback with an error or details of 
  the message that was sent
   server.send(message, function(err, message) { console.log(err || 
   message); });

标签: javascriptnode.jsemailnpm

解决方案


推荐阅读