# Issue with custom email template

**URL:** <https://community.dreamfactory.com/t/issue-with-custom-email-template/1906>\
**Category:** REST API\
**Created:** [December 9, 2015, 11:26am UTC](https://community.dreamfactory.com/t/issue-with-custom-email-template/1906 "2015-12-09T11:26:19Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![allensandiego](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@allensandiego](https://community.dreamfactory.com/u/allensandiego)\
**Post date:** [December 9, 2015, 11:26am UTC](https://community.dreamfactory.com/t/issue-with-custom-email-template/1906/1 "2015-12-09T11:26:19Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![kimpatro](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/kimpatro/32/467_2.png) [@kimpatro](https://community.dreamfactory.com/u/kimpatro)\
**Post date:** [December 9, 2015, 12:49pm UTC](https://community.dreamfactory.com/t/issue-with-custom-email-template/1906/2 "2015-12-09T12:49:21Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![allensandiego](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@allensandiego](https://community.dreamfactory.com/u/allensandiego)\
**Post date:** [December 9, 2015, 12:52pm UTC](https://community.dreamfactory.com/t/issue-with-custom-email-template/1906/3 "2015-12-09T12:52:20Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![kimpatro](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/kimpatro/32/467_2.png) [@kimpatro](https://community.dreamfactory.com/u/kimpatro)\
**Post date:** [December 9, 2015, 12:54pm UTC](https://community.dreamfactory.com/t/issue-with-custom-email-template/1906/4 "2015-12-09T12:54:55Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![allensandiego](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@allensandiego](https://community.dreamfactory.com/u/allensandiego)\
**Post date:** [December 11, 2015, 1:51am UTC](https://community.dreamfactory.com/t/issue-with-custom-email-template/1906/5 "2015-12-11T01:51:51Z")

</div>

> [@kimpatro](#):
>
> 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

---

<div class="post-metadata">

**Author:** ![kimpatro](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/kimpatro/32/467_2.png) [@kimpatro](https://community.dreamfactory.com/u/kimpatro)\
**Post date:** [December 11, 2015, 11:09am UTC](https://community.dreamfactory.com/t/issue-with-custom-email-template/1906/6 "2015-12-11T11:09:34Z")

</div>

Hi Allen,

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

---

<div class="post-metadata">

**Author:** ![allensandiego](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@allensandiego](https://community.dreamfactory.com/u/allensandiego)\
**Post date:** [December 11, 2015, 10:15pm UTC](https://community.dreamfactory.com/t/issue-with-custom-email-template/1906/7 "2015-12-11T22:15:40Z")

</div>

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](mailto:no-reply@dreamfactory.com)  
> Reply to Name: Blank  
> Reply to Email: Blank

Here’s the email I received.

 ![](https://canada1.discourse-cdn.com/flex035/uploads/dreamfactory/original/1X/0c43823f8ebcae119e2e5bf2b3c3d235b4d75db5.png)

Regards,  
Allen

---

<div class="post-metadata">

**Author:** ![allensandiego](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@allensandiego](https://community.dreamfactory.com/u/allensandiego)\
**Post date:** [December 14, 2015, 1:34am UTC](https://community.dreamfactory.com/t/issue-with-custom-email-template/1906/8 "2015-12-14T01:34:18Z")

</div>

Hi,

I’m still having an issue with this.

Can anyone help?

Thanks,  
Allen

---

<div class="post-metadata">

**Author:** ![allensandiego](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@allensandiego](https://community.dreamfactory.com/u/allensandiego)\
**Post date:** [December 14, 2015, 6:37am UTC](https://community.dreamfactory.com/t/issue-with-custom-email-template/1906/9 "2015-12-14T06:37:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![kimpatro](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/kimpatro/32/467_2.png) [@kimpatro](https://community.dreamfactory.com/u/kimpatro)\
**Post date:** [December 14, 2015, 10:36am UTC](https://community.dreamfactory.com/t/issue-with-custom-email-template/1906/10 "2015-12-14T10:36:37Z")

</div>

Hi Allen,

try change this at your email template:

**Sender Name: DO NOT REPLY**  
**Sender Email: [no-reply@dreamfactory.com](mailto:no-reply@dreamfactory.com)**

---

<div class="post-metadata">

**Author:** ![allensandiego](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@allensandiego](https://community.dreamfactory.com/u/allensandiego)\
**Post date:** [December 15, 2015, 4:39am UTC](https://community.dreamfactory.com/t/issue-with-custom-email-template/1906/11 "2015-12-15T04:39:32Z")

</div>

Hi,

Those values are already there by default.

Regards,  
Allen

---

<div class="post-metadata">

**Author:** ![kimpatro](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/kimpatro/32/467_2.png) [@kimpatro](https://community.dreamfactory.com/u/kimpatro)\
**Post date:** [December 15, 2015, 10:26am UTC](https://community.dreamfactory.com/t/issue-with-custom-email-template/1906/12 "2015-12-15T10:26:07Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![allensandiego](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@allensandiego](https://community.dreamfactory.com/u/allensandiego)\
**Post date:** [December 16, 2015, 4:44am UTC](https://community.dreamfactory.com/t/issue-with-custom-email-template/1906/13 "2015-12-16T04:44:28Z")

</div>

Hi,

Still not working properly when adding template in the Payload.

---

<div class="post-metadata">

**Author:** ![jayp](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/jayp/32/973_2.png) [@jayp](https://community.dreamfactory.com/u/jayp)\
**Post date:** [March 15, 2016, 11:41am UTC](https://community.dreamfactory.com/t/issue-with-custom-email-template/1906/14 "2016-03-15T11:41:38Z")

</div>

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

Thanks @allensandiego

---

<div class="post-metadata">

**Author:** ![dipoM](https://avatars.discourse-cdn.com/v4/letter/d/90ced4/32.png) [@dipoM](https://community.dreamfactory.com/u/dipoM)\
**Post date:** [September 27, 2016, 4:33am UTC](https://community.dreamfactory.com/t/issue-with-custom-email-template/1906/15 "2016-09-27T04:33:36Z")

</div>

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.
