Closed sukhcha-in closed 5 years ago
You should use use
language construct.
see: https://www.php.net/manual/en/functions.anonymous.php
As following:
Mail::send([], [], function (Message $message) use ($name, $email) {
...
}
@s-ichikawa thanks for that info, SendgridTransport gives error:
"Class 'App\Http\Controllers\SendgridTransport' not found"
Do i need to create SendgridTransport
Controller? What needs to be there in?
@s-ichikawa I fixed that by using 'sendgrid/x-smtpapi'
instead of SendgridTransport
Is this a good way to do this?
@sukhcha-in Yes, it is no problem too.
Or you can solve by correct use namespace
.
@s-ichikawa Great 😄 Thanks for this awesome library! Is there any way to check JSON response that we get from sendgrid?
Sorry, there isn't. Because the API response is abandoned here... https://github.com/laravel/framework/blob/5.8/src/Illuminate/Mail/Mailer.php#L259 https://github.com/laravel/framework/blob/5.8/src/Illuminate/Mail/Mailer.php#L484
Hello, Why my variable
$name
and$email
is not getting passed to Mail? It throws:Undefined variable: name
Here is my code:If i try to hardcode
Email
andName
variable it throws: