Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

333
Views
SendinBlue, guzzle: Connection refused

I'm working on a project where I need to send transactional emails to my clients.

The following error appears when sending the request. I use SendinBlue V3 SDK.

Exception when calling TransactionalEmailsApi->sendTransacEmail: Connection refused for URI
https://api.sendinblue.com/v3/smtp/email

My method code:

$config = Configuration::getDefaultConfiguration()->setApiKey('api-key', 'secret');
$apiInstance = new TransactionalEmailsApi(
    new GuzzleHttp\Client([
        'base_uri' => 'https://[secret].online'
    ]),
    $config
);
$sendSmtpEmail = new SendSmtpEmail();
$sendSmtpEmail['to'] = [
    [
        'email' => $parameters['mail'],
        'name' => $parameters['user'],
    ]
];
$sendSmtpEmail['templateId'] = 3;
$sendSmtpEmail['params'] = [
    'FIRSTNAME' => $parameters['user'],
    'LASTNAME' => $parameters['verification_code'],
];

try {
    $result = $apiInstance->sendTransacEmail($sendSmtpEmail);
    print_r($result);
} catch (ConnectException $e) {
    echo 'Exception when calling TransactionalEmailsApi->sendTransacEmail: ', $e->getMessage(), PHP_EOL;
}
over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Did you configure correctly your https client with Guzzle ? If not connecting, then you can check if any other exceptions are thrown. You have a great inventory of them in the Guzzle documentation : https://docs.guzzlephp.org/en/stable/quickstart.html#exceptions

. \RuntimeException
└── TransferException (implements GuzzleException)
    ├── ConnectException (implements NetworkExceptionInterface)
    └── RequestException
        ├── BadResponseException
        │   ├── ServerException
        │   └── ClientException
        └── TooManyRedirectsException

In your case, it is a ConnectException. Try to get more information about it.

Why ConnectException are thrown usually ? When you can not connect.

When you can not connect ? When you are not using correct endpoint url, have not configured your HTTP client to use HTTPS protocol, not using the endpoint accordingly to its specs you'll find inside official documentation.

You can look the official tutorial too : https://developers.sendinblue.com/docs/send-a-transactional-email

You can use the github.com sendinblue official repository too with the php api well described : https://github.com/sendinblue/APIv3-php-library

over 4 years ago · Santiago Trujillo Report

0

Document says: Relay access has been refused Authentication may have failed: check your API key,

Please also be sure that your 587 port is open.

run php artisan cache:clear and php artisan config:clear

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!