s-ichikawa/laravel-sendgrid-driver

base64_encode() expects parameter 1 to be string, array given

serg1uu opened this issue · 2 comments

I'm using Laravel Framework 8.68.0 and s-ichikawa/laravel-sendgrid-driver: "^2.1.0".

\Mail::send([], [], function ($message) use ($emails) {
    $message
        ->to($emails)
        ->from(config('mail.friends_invite_email'), 'Invites')
        ->subject('Join our platform')
        ->embedData([
            'template_id' => config('services.sendgrid.templates.invite_friends'),
        ], SendgridTransport::SMTP_API_NAME);
});

takes a bit longer to execute then fails with an error: base64_encode() expects parameter 1 to be string, array given

I also tried using the sgEncode helper and the email is successfully sent but it doesn't use the dynamic template I specified. I also think that read.me instructions need to be updated. Do we still need to provide the .env and config/services.php files a SENDGRID_API_KEY entry? it seems that providing MAIL_PASSWORD and MAIL_USERNAME=apikey is enough.

Capture

This library does not use MAIL_PASSWORD and MAIL_USERNAME.
Didn't you send an email via SMTP? If so, you didn't use any code of this library.

I ended up reinstalling the package and providing `php.ini``s with a new SSL certificate. My emails seems to work

curl.cainfo = C:\xampp\php\extras\ssl\cacert.pem