BillionMail icon indicating copy to clipboard operation
BillionMail copied to clipboard

I suggest pushing attribute feature to send email via API

Open nguyenary opened this issue 6 months ago • 1 comments

Currently, sending emails via API will send a fixed, available template. If my email template has dynamic parameters, it will not be possible to customize when sending via API.

I propose adding the attribute push and auto replace functions in the mail template to be able to pass dynamic parameters to the email template instead of fixed mail as it is now.

nguyenary avatar Jun 23 '25 08:06 nguyenary

Very helpful suggestions, thank you. It will be added to the next release.

dreambladeflag avatar Jun 25 '25 03:06 dreambladeflag

Has this been added? The docs makes it seem like this feature's been added: https://www.billionmail.com/start/api_mail_guide.html

Image

However, I have a template which contains:

<p>Hey {{.API.first_name}} {{.API.last_name}},</p>

And try :

curl -k -X POST 'https://mail.example.com/api/batch_mail/api/send' -H 'X-API-Key: MYAPIKEY' -H 'Content-Type: application/json' -d '{
    "recipient": "[email protected]",
    "attribs": {
        "first_name": "Jesse",
        "last_name": "Jackson"
    }
}'

But it doesn't work

fraschm1998 avatar Jul 26 '25 23:07 fraschm1998

Has this been added? The docs makes it seem like this feature's been added: https://www.billionmail.com/start/api_mail_guide.html

Image However, I have a template which contains:
<p>Hey {{.API.first_name}} {{.API.last_name}},</p>

And try :

curl -k -X POST 'https://mail.example.com/api/batch_mail/api/send' -H 'X-API-Key: MYAPIKEY' -H 'Content-Type: application/json' -d '{
    "recipient": "[email protected]",
    "attribs": {
        "first_name": "Jesse",
        "last_name": "Jackson"
    }
}'

But it doesn't work

@fraschm1998 Hey, can you tell me what you encountered? It's not sent email or variables not replaced?

bt-dev3 avatar Jul 28 '25 02:07 bt-dev3

@bt-dev3 The email was sent but the variables were not replaced:

Image

fraschm1998 avatar Jul 28 '25 02:07 fraschm1998

@fraschm1998 That is confusing. I'm successful in replacing the variables in my testing. Are you using the latest release?

dreambladeflag avatar Jul 28 '25 07:07 dreambladeflag

@fraschm1998 That is confusing. I'm successful in replacing the variables in my testing. Are you using the latest release?

What email template are you using for testing and what curl command?

I'm using V4.0

Edit: I figured it out.. If the email template contains any {{randomVariable}} alongside {{.API.randomVariable}} then it will ignore the {{.API.randomVariable}}

Edit2: Btw the title on the Template page is in Chinese

Image

fraschm1998 avatar Jul 28 '25 12:07 fraschm1998

@fraschm1998 Very helpful information, we'll fix it in the next release, thank you.

dreambladeflag avatar Jul 29 '25 01:07 dreambladeflag