Christian Menger
Christian Menger

Reputation: 1

Add BCC to Woocoomerce transactional email sent through Sendinblue

We are currently using Sendinblue as mail marketing provider and did set it up on our Wordpress/Woocommerce shop to handle marketing and transactional emails now.

Before that, we used to send some transactional woocommerce transactional email, such as order_completed in bcc to one of our own email addresses. This is necessary for certain internal processes.

Hence Sendinblue has taken over, this function isn't being triggered, or more like is triggered but doesn't get processed through Sendinblue anymore.

Although, I found an API call that could actually do exactly that: https://developers.sendinblue.com/reference#sendtransacemail

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.sendinblue.com/v3/smtp/email",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{\"bcc\":[{\"email\":\"[email protected]\"}]}",
  CURLOPT_HTTPHEADER => array(
    "accept: application/json",
    "content-type: application/json"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

As well as this: https://apidocs.sendinblue.com/tutorial-sending-transactional-email/

Though, I'm absolutely unsure where to add this in order to trigger BCC through Sendinblue.

Would be amazing, if someone could point me in the right direction.

Kind Regards Chris

Upvotes: 0

Views: 402

Answers (1)

Mohamed Ali O.Ameur
Mohamed Ali O.Ameur

Reputation: 743

you don't have to use the API calls to be able to use Sendinblue for Email. What you should do is just making Sendinblue as your Email Server by entering your Sendinblue server details as your Wordpress default SMTP server. You can use the following code to do so.

If you do the above your website will function normally and all triggers will work just fine, the only thing if that your website will use Sendinblue as it's Email Server and all the sent emails will be logged to your Sendinblue account.

  1. How to get your Sendinblue SMTP account working: https://help.sendinblue.com/hc/en-us/articles/209463245--How-can-I-get-my-SendinBlue-SMTP-account-activated-

  2. Very simple article to help you with configuring your SMTP: https://help.dreamhost.com/hc/en-us/articles/215526937-Configuring-the-WP-Mail-SMTP-plugin

Good luck!

Upvotes: 0

Related Questions