Issue with custom email template

Hi,

I created a custom email template in my DF 2.0. Then I tried to do a POST on my email service with the following payload:

{
  "template": "Custom User Registration",
  "to": [
    {
      "name": "Allen Sandiego",
      "email": "admin@domain.com"
    }
  ],
  "name" : "Allen Sandiego"
}

I have set a Subject, Message, From Name and From Email. However, the email I keep receiving “DO NOT REPLY” as From Name, "no-reply@dreamfactory.com" as From Email, “(no subject)” as Subject and an empty message.

Can anyone help me with this.

Thanks,
Allen

The template name should be the same, did you change the “Custom User Registration” template to be like you want?

*The last param “name” it’s not needed.

I created a new template “Custom User Registration”.

Right now I’m trying to pass the subject and body_html. It works like this but I’m hoping I don’t have to build the whole message like this.

In template you have to set all the things you need.

“Sender email” and “Sender name” is what you need to change, above the Body input.

Hi,

I reverted back to using the User Registration Default. Now when using this, I am also getting a blank message body, “[No Subject]” for subject.

This is what I’m using in my user.register.post.post_process event script.

var lodash = require("lodash.min.js");

var user = event.request.payload;

var emailPayload = {
    template: 'User Registration Default',
    to: {
        name: user.first_name,
        email: user.email
    }
};

platform.api.post("sendgrid", emailPayload);

Regards,
Allen

Hi Allen,

how it’s your “User Registration Default” email template? All fields filled?

Hi,

Please see below:

Template Name: User Registration Default
Template Description: Email sent to new users to complete registration.
Recipient: Blank
Cc: Blank
Bcc: Blank
Subject: [DF] Registration Confirmation
Body: emails.register
Sender Name: DO NOT REPLY
Sender Email: no-reply@dreamfactory.com
Reply to Name: Blank
Reply to Email: Blank

Here’s the email I received.

Regards,
Allen

Hi,

I’m still having an issue with this.

Can anyone help?

Thanks,
Allen

Hi,

Solved this by appending the template in the URL instead of the Payload.

ie.

platform.api.post("email?template=template_name", payload);

Regards,
Allen

2 Likes

Hi Allen,

try change this at your email template:

Sender Name: DO NOT REPLY
Sender Email: no-reply@dreamfactory.com

Hi,

Those values are already there by default.

Regards,
Allen

Yes,

you can (perhaps should) change those fields.
Just change it to what you want and select the template in your call to send email. Don’t need to put the email template in URL. Do this call:

var emailPayload = {
    template: 'User Registration Default',
    to: {
        name: user.first_name,
        email: user.email
    }
};

That’s it. Now the DF will select this template (User Registration Default) and use all config you set. That’s why you need to change the default values or create a new template if you’d like to personalize your email messages and settings.

Hi,

Still not working properly when adding template in the Payload.

Had the same issue and fixed using the workaround. i.e platform.api.post(“email?template=template_name”, payload);

Thanks @allensandiego

Thank you @allensandiego for the workaround. Spent almost an hour wondering what I was doing wrong.
This should be fixed or the documentation updated at the least.