Sending email

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: ["[email protected]"], 
    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 in the focused email box but can end up in clutter or even spam folders. Also, while we could send an email from one tenant to another, sending outside Office 365 doesn't seem to work. Under the hood, SharePoint PnP JavaScript Core Library is using REST endpoint /_api/sp.utilities.utility.sendemail, which you can also use without the library.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.172.115