javascript - i want to send email using send-grid but when i use the api_key it gives error while when i use the same api-key in previous projects it works
问题描述
i have created a new project and i want to send email on signup and password reset etc , when i used old api key it gave error **Error:
The provided authorization grant is invalid, expired, or revoked** but when i ran the older projects with same api-key it worked fine , also i tried new api-key but it is giving same error
const nodemailer = require("nodemailer")
const sTransport = require("nodemailer-sendgrid-transport")
const options = {
auth:{
api_key:process.env.SEND_GRID_KEY
}
}
const mailer = nodemailer.createTransport(sTransport(options))
router.get("/", async (req, res) => {
let products = await productSchema.find({});
let sendmail =await mailer.sendMail({
to:req.user.email,
from:process.env.FROM,
subject:"chekcing the key",
html:"just checking the send grid api !!"
})
解决方案
推荐阅读
- mongodb - 存储阿波罗服务器订阅
- javascript - 对 php 文件的 Javascript XHR 发布请求:加载资源失败:服务器响应状态为 404(未找到)
- git - 如何使用 jGit 限制每个文件版本的提交次数
- sql - T-SQL 将一列转为一行
- c# - 如何通过 wpf 中的代码使用对象递归填充树视图
- qt - 如何将 QML 文件组织到嵌套文件夹中?
- sql - 无法添加或更新子行我的 sql 数据库的外键约束失败
- javascript - 使用 jsrsasign 复制 openssl 命令
- oracle - Oracle PL/SQL 和 DocuSign 授权代码授予 - 获得 400 错误请求
- java - 列表
到地图 带流,带字符串拆分