Install the package
composer require s-ichikawa/laravel-sendgrid-driver
Add service provider
Add service provider in "config/app.php" in "providers" key, at the very bottom:
'providers' => [
Sichikawa\LaravelSendgridDriver\SendgridTransportServiceProvider::class
];
Add the service configuration in "config/services.php" at the very bottom of the file:
'sendgrid' => [
'api_key' => env('SENDGRID_API_KEY'),
],
Add credentials
Now we need to change the “.env” file to add the SendGrid Values, you can sign in with a free account in https://app.sendgrid.com and get 100 monthly emails for free or get a payment plan for more.
Create credentials.
The username and password to "signin" are going to be used in ".env" file.
You can go to settings on sidebar and click on "API keys" option.
Then press the blue button "Create API Key", you can set any name to your api key, and in “API key permissions” by default is selected “Full access” so create it with it.
The ".env" file:
MAIL_DRIVER=smtp
SENDGRID_API_KEY='your-generated-token'
MAIL_HOST=smtp.sendgrid.net
MAIL_PORT=587
MAIL_USERNAME='your-user-email-to-login-on-sendgrid'
MAIL_PASSWORD='your-password-to-login-on-sendgrid'
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=info@yourapp.com
MAIL_FROM_NAME=yourapp.com
Note:
MAIL_PORT will change from “25” or “587” for unencrypted/TLS connections and 465 for SSL connections.
Top comments (0)