为什么我没有收到任何来自sendgrid的邮件?



我的代码有什么问题?我也用sendgrid代码中提到的电子邮件进行了单个发件人验证,并收到此通知"您的帐户暂时正在审查中"。为什么会这样?

router.post('/delete-account',(req,res)=>{
User.findOne({email:req.body.email}).then(user=>{
if(!user){
return res.status(422).json({error:"Invalid credentials"})
}
user.save().then((user)=>{
const sgMail = require('@sendgrid/mail')
sgMail.setApiKey("**************************************************")
const msg = {
to: user.email, // Change to your recipient
from: 'money148001@gmail.com', // Change to your verified sender
subject: 'Delete Account Request',
text: 'Explore and enjoy beautiful posts and videos by making a lot of friends online',
html: `Hii <strong>${user.username}</strong> we have seen your request for deleting the account. You are just one step away now. Kindly email us the reason behind deleting it and get it deleted permanently.<br>
<h2>Have a good day..!!!</h2>`
}
sgMail
.send(msg)
.then(() => {
console.log('Email sent')
})
.catch((error) => {
console.error(error)
})
res.json({message:"Check your email messages for further information"})
})
})
})

下面是我的客户端程序,我将调用上面提到的程序

import React,{useState,useContext,} from 'react'
import {Link,useHistory} from 'react-router-dom'
import M from 'materialize-css'
import {UserContext} from '../../App'
const DeleteAccount  = ()=>{
const history = useHistory()
const [email,setEmail] = useState("")
const[passward,setPasword] = useState("")
const {state,dispatch} = useContext(UserContext)
const [isPasswordShown,setIsPasswordShown] = useState(false);
const togglePassword = () =>{
setIsPasswordShown(!isPasswordShown);
}
const PostData = ()=>{
if(!/^(([^<>()[]\.,;:s@"]+(.[^<>()[]\.,;:s@"]+)*)|(".+"))@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}])|(([a-zA-Z-0-9]+.)+[a-zA-Z]{2,}))$/.test(email)){
M.toast({html: "Invalid email",classes:"#c62828 red darken-3"})
return
}
fetch('/delete-account',{
method:"post",
headers:{
"Content-Type":"application/json"
},
body:JSON.stringify({
email,
passward
})
}).then(res=>res.json())
.then(data=>{
if(data.error){
M.toast({html: data.error,classes:"#c62828 red darken-3"})
}
else{
M.toast({html:data.message,classes:"#43a047 green darken-1"})
localStorage.clear()
dispatch({type:"CLEAR"})
history.push('/signin')
}
})
.catch(err=>{
console.log(err)
})
}
return (
<div className="mycard">
<div className="card auth-card input-field">
<h2>Instagram</h2>
<input
type="text"
placeholder="Enter your email id"
value={email}
onChange={(e)=>setEmail(e.target.value)}
/>
<input
type={isPasswordShown ? "text":"password"}
placeholder="Enter your password"
value={passward}
onChange={(e)=>setPasword(e.target.value)}
/>
<button style={{fontSize:"15px"}} className="btn #64b5f6 blue darken-1" onClick={togglePassword}>
{isPasswordShown===true?<p style={{fontSize: "15px",marginTop:"0px"}}>Hide Password</p>:<p style={{fontSize: "15px",marginTop:"0px"}}>Show Password</p>} <i style={{fontSize:"15px"}} className="far fa-eye"></i>
</button>
<br></br>
<br></br>
<button className="btn #c62828 red darken-3"
onClick={()=>PostData()}
>
Delete My Account
</button>


</div>
</div>
)
}

export default DeleteAccount

Twilio SendGrid开发者布道者在此。

如果您收到"您的帐户暂时正在审查中"的通知;那么您的帐户目前是审查过程的一部分。您可以在这里阅读关于SendGrid帐户审查过程的内容。

SendGrid应该已经向您的帐户电子邮件地址发送了一封电子邮件,让您知道您处于哪个审查阶段;警告、暂停、停用、禁止

这封邮件可能会询问你更多关于你的账户使用的细节,你应该尽可能多地回复这封邮件。向客户团队提供尽可能多的信息,可以帮助他们更快地重新激活您的帐户。

如果您找不到SendGrid团队的这封电子邮件,我建议您联系SendGrid支持。

我希望你很快就能畅通无阻。

相关内容

最新更新