1

I want to send mail to some users. But when i call send mail method, it shows no errors. but email not send.here is my code.

public emailProps: EmailProperties = {
                        To: ["abc@gmail.com"],
                        CC: ["def@gmail.com"],
                        Subject: "This email is about...",
                        Body: "Here is the body. <b>This is the test mail form SharePoint/b>",
                    };
public submit = () => {        
    sp.setup({
        spfxContext: this.props.context
    });

    return sp.utility.sendEmail(this.emailProps).then(rec => {
        console.log("Email Sent!", rec);
    },
    (ex) => {
          console.log("error: ", ex);
    });
}
  • Can you please post the error you are getting? – Ganesh Sanap Sep 26 at 6:51
  • I am not getting any error. I print in console log email sent. and it shows email sent.but user not getting any email – Nahid Hasan Kakon Sep 26 at 6:52
  • Are you sending an email to external users? Have you tried debugging where the execution goes? in success or error block of send email?? Also check the Official documentation. – Ganesh Sanap Sep 26 at 6:57
  • yes i tried to send mail to external user. i included console log in success and error block. success block is called. you see my code. when click send mail button it shows in console log 'email sent !'. – Nahid Hasan Kakon Sep 26 at 7:02
0

According the below issue posted in GitHub, SharePoint REST API or PnP Core JS only sends an email to SharePoint site users NOT to external users.

send email to external users PnP core js.

  • Hi Nahid, Does this answers your question? If Yes, please accept it as an answer so that this question will not appear in Unanswered questions list. – Ganesh Sanap Oct 7 at 10:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.