Jump to content
techwthquestion

Send template to user using PHP or API

Recommended Posts

Hello,

I want to send an email template to the user. At the same time I want to list that email in email history.  I tried to send email with the help of the link https://developers.whmcs.com/api-reference/sendemail/

 but I am not getting any results  Here is my code 

 

            'action' => 'SendEmail',
            // See https://developers.whmcs.com/api/authentication
            'username' => 'admin',
            'password' => 'password ',
            'messagename' => 'Email_Temaplte_name_Herel',
            'id' => '1',  //  i used client id here 
            'responsetype' => 'json',

        )
    )
);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
curl_close($ch);

Can I get some help on this ? 

Thanks

 

Edited by techwthquestion

Share this post


Link to post
Share on other sites

So just to confirm, when you print_r($response)  it shows nothing?

Also, are you using this within an external app or like a module in whmcs?   If a module, hook, etc, use the internal  API (locapi example it gives) instead as you don't need to worry about the login bits and I suspect that is the issue here. 

Edited by steven99

Share this post


Link to post
Share on other sites
On 11/24/2021 at 1:06 AM, techwthquestion said:

 

 

Hello,

I want to send an email template to the user. At the same time I want to list that email in email history.  I tried to send email with the help of the link https://developers.whmcs.com/api-reference/sendemail/

 but I am not getting any results  Here is my code 

 

            'action' => 'SendEmail',
            // See https://developers.whmcs.com/api/authentication
            'username' => 'admin',
            'password' => 'password ',
            'messagename' => 'Email_Temaplte_name_Herel',
            'id' => '1',  //  i used client id here 
            'responsetype' => 'json',

        )
    )
);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
curl_close($ch);

Can I get some help on this ? 

Thanks

 

Hello

you should add your IP to API list

do you do it?

Share this post


Link to post
Share on other sites
On 11/28/2021 at 9:40 PM, developer _WHM_CS said:

Hello

you should add your IP to API list

do you do it?

Hello All,

 

Able to send that with the the internal API.

Edited by techwthquestion

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

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