首页 > 解决方案 > 为什么我没有收到来自 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

标签: node.jstwiliosendgridmern

解决方案


Twilio SendGrid 开发人员布道者在这里。

如果您收到“您的帐户正在接受审核”的通知,那么您的帐户目前正在审核过程中。您可以在此处阅读有关SendGrid 帐户审核流程的信息。

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

该电子邮件可能会要求您提供有关帐户使用情况的更多详细信息,您应尽可能详细地回复该电子邮件。向客户团队提供尽可能多的信息将帮助他们更快地重新激活您的帐户。

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

希望你早日解封。


推荐阅读