Search code examples
firebasegoogle-cloud-firestoregoogle-cloud-functionsfirebase-extensions

Email Trigger from Firebase Message and Subject empty


enter image description hereI installed and I'm testing the Email Trigger extension from Firebase. This extension created a "mail" collection on Firestore, where I add a new document using the fields "to", "Message" and "Subject". I can receive the email but the problems are that the Subject and message comes empty. I'm testing the extension just filling the fields from the Firestore database, not from the code. Does anybody know the right format structure to fill those fills? (subject and message). Please see the image attached. Thanks.


Solution

  • Your document is not the correct format. The message field should be an object containing subject, html and/or text bodies:

    admin.firestore().collection('mail').add({
      to: 'someone@example.com',
      message: {
        subject: 'Hello from Firebase!',
        html: 'This is an <code>HTML</code> email body.',
      },
    })
    

    You are instead supplying message as a string. Read the usage instructions for your installed extension for additional details.