Closed valehasadli closed 5 years ago
@nanophp Hi, What is your laravel version? My laravel 5.7 code is working with the dynamic template. like following: https://github.com/s-ichikawa/laravel57/blob/master/app/Console/Commands/Mail/ApiSimple.php#L43
@nanophp Hi, What is your laravel version? My laravel 5.7 code is working with the dynamic template. like following: https://github.com/s-ichikawa/laravel57/blob/master/app/Console/Commands/Mail/ApiSimple.php#L43
Hi, my laravel app version is 5.8.16.
@s-ichikawa I'm wanna using template id without the laravel view.
@s-ichikawa I got such email
@s-ichikawa I got such email
app('mailer')->send([], [], function (Message $message) { $message ->subject('Invoice.') ->to($this->data['to']) ->from('noreply@thecompass.travel') ->embedData(self::sgEncode([ 'personalizations' => [ [ 'to' => [ 'email' => $this->data['to'], 'name' => 'TheCompass Digital', ], 'dynamic_template_data' => [ 'branch_name' => 'Shingo Ichikawa', ], ], ], 'template_id' => 'eeeee' ]), SendgridTransport::SMTP_API_NAME); });
I tried with 5.8, but worked well. https://github.com/s-ichikawa/laravel58/blob/master/app/Console/Commands/Mail/ApiSimple.php#L45
Is your MAIL_DRIVER
value in .env file seted smtp
?
I got the same case in this way.
You must edit to sendgrid
for using this library.
https://github.com/s-ichikawa/laravel-sendgrid-driver#configure
https://github.com/s-ichikawa/laravel58/blob/master/app/Console/Commands/Mail/ApiSimple.php#L45
@s-ichikawa Yes, MAIL_DRIVER
setted as smtp
`MAIL_DRIVER=smtp MAIL_HOST=smtp.sendgrid.net MAIL_PORT=587 MAIL_USERNAME=my_username MAIL_PASSWORD=my_pass MAIL_ENCRYPTION=tls MAIL_FROM_NAME="Compass Digital" MAIL_FROM_ADDRESS=noreply@thecompass.travel
SENDGRID_ENDPOINT=https://api.sendgrid.com/v3/mail/send`
Also, my current code looks like this
I tried with 5.8, but worked well. https://github.com/s-ichikawa/laravel58/blob/master/app/Console/Commands/Mail/ApiSimple.php#L45
Is your
MAIL_DRIVER
value in .env file setedsmtp
? I got the same case in this way.You must edit to
sendgrid
for using this library. https://github.com/s-ichikawa/laravel-sendgrid-driver#configure
I need to receive sendgrid template as an email
Please, change MAIL_DRIVER
value to sendgrid
from smtp
.
In setted smtp
, you are not able to call this library.
@s-ichikawa Thankssssss!!! :)))))) It works!!!!
@s-ichikawa hey i get an email like this and my error looks like this please give me any solution my sendgrid dynamic template id is not receive as an email in laravel
Hi, thanks for the great package,
I have some issues about using SendGrid templates. In another client, everything works fine.
{ "personalizations": [ { "to" : [ { "email" : "valehasadli@gmail.com", "name": "Valeh Asadli" } ], "dynamic_template_data": { "branch_name": "Galiano" } } ], "from": { "email" : "noreply@thecompass.travel", "name" : "Compass Travel" }, "template_id" : "temp_idxxx" }
this JSON totally working fine postman client, variable passed and I get an email. But I facing this problem LARAVEL code.
Mail::send([], [], function (Message $message) { $message ->to($this->data['to']) ->from('noreply@thecompass.travel') ->subject('Invoice') ->embedData( json_encode([ 'personalizations' => [ [ 'dynamic_template_data' => [ 'branch_name' => 'amk', ], ], ], 'template_id' => 'xxxx', ]), SendgridTransport::SMTP_API_NAME ); });
I got an email but SMTP type file and JSON structure. How can I fix
JOB FILE:
`<?php
namespace App\Jobs;
use Illuminate\Bus\Queueable; use Illuminate\Mail\Message; use Illuminate\Queue\SerializesModels; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Foundation\Bus\Dispatchable; use Illuminate\Support\Facades\Mail; //use App\Mail\SendReservationInvoice as SendReservationInvoiceMail; use Sichikawa\LaravelSendgridDriver\SendGrid; use Sichikawa\LaravelSendgridDriver\Transport\SendgridTransport;
class SendReservationInvoice implements ShouldQueue { private $data;
// Mail::to($this->data['to']) // ->send(new SendReservationInvoiceMail($this->data));
} `