Jump to content
altomarketing

Api to sendemail can not sent template, only custom variables

Recommended Posts

Hi, I'm needed to send me an email from api, a template defined in the system related to invoices

My API code to send emails works well, but only if you use custom variables, such as subject, body, etc. But I want to send an email template that I have in the whmcs

According to https://developers.whmcs.com/api-reference/sendemail/ , in order to indicate to the API that the ID = IS ONE INVOICE ID, I must define

$ postfields ["customtype"] = "invoice";

Then there I can say:

$ postfields ["id"] = (int) $ invoiceId; // here is my id To be able to send the information related to the invoice.

But I just define it:

["customtype"] = "invoice"
["messagename"] = "New Tax Invoice generated"; // this is the system template.

the api gives error me

1. Answer: Answer: {"result": "error", "message": "A subject is required for a personalized message"} //
2. Answer: {"result": "error", "message": "A body of the message is required for a personalized message"} //

I do not want a personalized message or a personalized SUBJECT. I just want to send my messagename (template)

I repeat that i dont want to use custommessage , customsubject or customvars. I just want to send the whmcs template related to the invoice.

Suggestions?

Share this post


Link to post
Share on other sites

I found it !!!

I dont have to define

["customtype"] = "invoice"

only with this lines works !!

	$postfields["messagename"] = "Nueva Factura Fiscal generada";
        $postfields["id"] = (int)$invoiceId;

 

Share this post


Link to post
Share on other sites

Yes, once you add any of the custom fields, besides customvars, it handles the request as a complete custom message. 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated