It is possible and easy to send email using SharePoint PnP JavaScript Core Library. You can do it by defining an object based on the EmailProperties interface, and send it using the utility.sendEmail function:
const emailProperties: EmailProperties = { To: ["olli@opax.onmicrosoft.com"], CC: [], Subject: "Testing PnP JavaScript send email functionality", Body: "This email has been sent using JavaScript", }; pnp.sp.utility.sendEmail(emailProperties).then(() => { this.domElement.innerHTML = `<p>Email has been sent.</p>`; });
This function doesn't send the email as the user in whose context we are working but as SharePoint Online system. You don't have to be tenant admin to send this email:
A word of caution here: based on our testing, this functionality currently only works on classic SharePoint sites but not in modern Team Sites. It is also highly likely that the email will not appear...