Skip to content

Instantly share code, notes, and snippets.

@TBag
Created February 1, 2017 20:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save TBag/866bfa2de1aa469b72f08d88b97bdfc9 to your computer and use it in GitHub Desktop.
Save TBag/866bfa2de1aa469b72f08d88b97bdfc9 to your computer and use it in GitHub Desktop.
SpFxFlowEmailWebPart sendEmailViaOffice365Outlook method
private sendEmailViaOffice365Outlook(emailaddress: string, emailSubject: string, emailBody: string): Promise<HttpClientResponse> {
const postURL = this.properties.flowURL;
const body: string = JSON.stringify({
'emailaddress': emailaddress,
'emailSubject': emailSubject,
'emailBody': emailBody,
});
const requestHeaders: Headers = new Headers();
requestHeaders.append('Content-type', 'application/json');
const httpClientOptions: IHttpClientOptions = {
body: body,
headers: requestHeaders
};
console.log("Sending Email");
return this.context.httpClient.post(
postURL,
HttpClient.configurations.v1,
httpClientOptions)
.then((response: Response): Promise<HttpClientResponse> => {
console.log("Email sent.");
return response.json();
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment