Forum Discussion

harshita_budati's avatar
harshita_budati
Copper Contributor
Nov 20, 2021

Not able to send a mail using Graph Explorer

I have tried to send a mail through Graph API but receiving an error that 

Remote Server returned '550 5.7.708 Service unavailable. Access denied, traffic not accepted from this IP. For more information please go to http://go.microsoft.com/fwlink/?LinkId=526653 AS(7230) [PNYPR01MB5114.INDPRD01.PROD.OUTLOOK.COM]'

 

Below is the code:

 

public sendMail(){

  const mail = {
    subject: "This is a sample",
    toRecipients: [{
        emailAddress: {
            address: "xxxxxx.com"
        }
    }],
    body: {
        content: "This is a sample",
        contentType: "html"
    }
};
   
this.props.context.msGraphClientFactory.getClient().then((client: MSGraphClient😞 void => {
    client
    .api('/me/sendMail')
    .post({message: mail}, (err, res) => {
        alert("Email Sent");
    });
   
  });

Resources