I have a SharePoint SPFx react web application. I'm using the following link to send emails on actions: https://pnp.github.io/pnpjs/sp/sp-utilities-utility/
My current code looks like this:
import { default as pnp, sp, ItemAddResult } from "sp-pnp-js";
export interface EmailProperties {
To: string[];
CC: string[];
BCC?: string[];
Subject: string;
Body: string;
From?: string;
}
On button submit I stripped out most of my code but I have this snippet here:
async submitNewForm():Promise<any> {
try {
//More code here
const emailProps: EmailProperties = {
To: ["emailhere@gmail.com"],
CC: ["cchere@gmail.com"],
Subject: "Title Here",
Body: `body code here`
};
sp.utility.sendEmail(emailProps).then(_ => {
console.log("Email Sent to user!");
});
} catch(error) {
}
}
Whenever this action get's triggered, the To
works but the CC
and BCC
do not. I figured maybe that email address I was using was maybe blocking the email from coming. However when I put the BCC email address in the To it works. In my console I don't get any errors I get the "Email Sent to User!"
Any idea on why the CC or BCC is not working, or how I can debug this to see what's going on?