In this tutorial,i will show you how to integrate sendgrid using laravel and codeigniter.sendgrid is a popular SMTP email provider.https://sendgrid.com/ this is the official site.this provider freely give 100 email perday.
Configuring SendGrid for SMTP integration in both Laravel and CodeIgniter frameworks involves similar steps. Here's a conclusion for setting up SendGrid SMTP integration in both frameworks
Begin by signing up for a SendGrid account. During the signup process, ensure to enable two-factor authentication (2FA). This step is crucial, as SendGrid mandates 2FA for all accounts, and you cannot disable it.
Once signed up, configure 2FA for your account. This additional security measure helps protect your SendGrid account from unauthorized access.
Settings Up SendGrid Account:
After logging in, generate an API key from the SendGrid dashboard. This API key will be necessary for integrating SendGrid with your Laravel application for sending emails.
Step 1 : Api Keys
Step 2 : Create Api Key
How to verify sender id:
Once logged in, navigate to the "Sender Authentication" section. This section may be found under the "Settings" or "Account Settings" menu, depending on the SendGrid dashboard's layout.SendGrid offers several methods for sender authentication, including Single Sender Verification, Domain Authentication, and Automated Security. Choose the appropriate method based on your requirements.
If you're using Single Sender Verification, enter the sender email address you wish to verify.
Step 1
After completing the verification process, your sender identity will be verified, and you'll receive a confirmation within the SendGrid dashboard.
Now i will show you how to integrate sendgrid using laravel just add the code in .env file.
Laravel
.env :
You can now send a test email to verify that everything is set up correctly. You can use Laravel's built-in Mail facade to send emails. For example:
That's it! Your Laravel application is now configured to send emails using SendGrid via SMTP.
CODEIGNITER
In your controller or wherever you want to send emails, load the CodeIgniter email library and use it to send emails. Here's a basic example:
By following these steps, you should be able to successfully configure SendGrid for SMTP integration in both Laravel and CodeIgniter frameworks, allowing your applications to send emails through SendGrid's infrastructure.