daily pastebin goal
13%
SHARE
TWEET

Untitled

a guest May 21st, 2018 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public async sendMessageAsync(message: IMessage): Promise<MessageSendResult> {
  2.         if (!message) {
  3.             throw new Error("Message can not be empty!");
  4.         }
  5.  
  6.         return new Promise<MessageSendResult>(async (resolve, reject) => {
  7.             try {
  8.                 await sendGridMailer.send({
  9.                     from: message.from,
  10.                     to: message.recipient,
  11.                     subject: message.subject,
  12.                     text: (!this.useHtmlMessages ? message.body : undefined),
  13.                     html: (this.useHtmlMessages ? message.body : undefined)
  14.                 });
  15.  
  16.                 return resolve({isSuccessful: true});
  17.             }
  18.             catch (err) {
  19.                 return reject(`An error occurred while sending a message: ${err}`);
  20.             }
  21.         });
  22.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top