Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

341
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda