0

With SharePoint Framework I use PnP Core Library to send mail to another user:

import pnp, { EmailProperties } from "sp-pnp-js";

const emailProps: EmailProperties = {
    To: ["user@site.com"],
    CC: ["user2@site.com", "user3@site.com"],
    Subject: "This email is about...",
    Body: "Here is the body. <b>It supports html</b>", // i need load this in Centralized location[without hardcoded];
};

pnp.sp.utility.sendEmail(emailProps).then(_ => {

    console.log("Email Sent!");
});

I want use template for "Body" property because I have several cases for a different template, because this is different in comparison SP Workflows

How would I do it in the best way? JSON in document library in current web? HTML in document library in current web?

  • 1
    I think storing HTML in lists is a good idea. And there are good examples on GitHub to get items from List. – Asad Refai Jul 26 '17 at 7:24
  • Thank you! Is this the best way to send an email with pnp-core-library in SPFx? – Goshky Jul 26 '17 at 7:54
  • 1
    In my opinion easiest and simple way with good performance is the best way. I find storing & retrieving data in list very easy. – Asad Refai Jul 26 '17 at 8:53

Your Answer

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

Browse other questions tagged or ask your own question.