Laravel send email verification to a registered user - laravel

I am new to Laravel. I have easily implemented Laravel email verification for the registered based on Laravel https://laravel.com/docs/5.8/verification
its working fine for testing purpose in local server. now I want to upload to server. now it's using default Mailtrap to receive an email of all the users.
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=****
MAIL_PASSWORD=****
MAIL_ENCRYPTION=tls
//user.php
class User extends Authenticatable implements MustVerifyEmail
{
use Notifiable;
My requirement is after registering, the email should send to the registered emailId, not to the mailtrap account. I have researched a lot on this in google but all the solution is only for sending emails to mailtrap or others but instead, I want to send to the users' email ID with the verification link.

I am assuming you have successfully implemented the activation email.
For your application to send email to the registered user email address you need to provide your email server SMTP credentials. For live application, you can not use mail trap credentials. If you use mailtrap credentials you will only get emails to your mail trap account.
If you do not have live smtp server credential, you can create a Gmail account and user Gmail SMTP credentials.
And one more thing, if you are using Gmail, change settings for Less secure app from your google account.

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=****
MAIL_PASSWORD=****
MAIL_ENCRYPTION=tls
this is .env configuration you have change to your own mail server. so that laravel will send email using these settings to the registered users.

Related

Failed to send message from Laravel controller

I tried to send an email from a Laravel controller, but it's showing this error. I'm not using a two step verified Gmail account. Most tutorials use the "enable less secure app" settings, but I can't enable that option in my account.
this is my env file
MAIL_MAILER=smtp
MAIL_HOST=smtp.googlemail.com
MAIL_PORT=465
MAIL_USERNAME=******
MAIL_PASSWORD=******
MAIL_ENCRYPTION=ssl
MAIL_FROM_ADDRESS=********
MAIL_FROM_NAME="${APP_NAME}"
Please use your google app password in MAIL_PASSWORD

Why I do not recieve emails sent in laravel at yahoo.com account?

In my Laravel 8 I use sendgrid for emails with account info in .env file:
MAIL_MAILER=smtp
MAIL_HOST=smtp.sendgrid.net
MAIL_PORT=587
MAIL_FROM_ADDRESS=myaccount#gmail.com
MAIL_USERNAME=apikey
MAIL_PASSWORD="XX.XXXXXXXXX_XXXXX.XXXXXXXXXXXXXXXX"
MAIL_ENCRYPTION=tls
and emailing in control like :
Mail::to($new_user)->send(new UserRegistered($subject,
$site_home_url,
$new_user->email,
$new_user->full_name,
$confirm_url,
$support_signature
));
where UserRegistered is app/Mail/UserRegistered.php file
and testing with several my email accounts I found that I recieve emails at all my accounts, except
yahoo.com. Checking Spam folder I see it is empty : https://imgur.com/a/NblVlJG
I wonder why I do not receive emails at yahoo.com? any additive rules of yahoo.com?
Are there any debugging tools on Sendgrid side or Laravel?

email verification on laravel 7

I have a question, actually, I'm developing a web site using laravel 7 and I successfully make an email verification and password reset functionality using mailtrap.io; but all theses just in localhost, I'm wondering if there is any other way to use it in the production side because I want users to receive the email verification and password reset response on them's email not on mailtrap website.
here is an image shows the email verification and password reset response
enter image description here
You can use sendgrid.com for mail delivery.
Make sure you configure DNS correctly before using it and configure the White Label correctly for you Domain.
.env
MAIL_MAILER=smtp
MAIL_HOST=smtp.sendgrid.com
MAIL_PORT=465
MAIL_USERNAME=apikey
MAIL_PASSWORD=your_api_key_here
MAIL_ENCRYPTION=ssl
MAIL_FROM_ADDRESS=no-reply#yourdomain.com
MAIL_FROM_NAME="${APP_NAME}"

laravel "error when sending email fwrite(): send of 18 bytes failed with errno=10054"

I am using laravel I got this error when I send emails
fwrite(): send of 18 bytes failed with errno=10054 An existing connection was forcibly closed by the remote host.
it was working normally
this is my configuration
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=givkom#gmail.com
MAIL_PASSWORD=123456789
MAIL_ENCRYPTION=tls
Mail::to($request->email)->send(new DonorMail());
change .env file like this:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.googlemail.com
MAIL_PORT=465
MAIL_USERNAME=ENTER_YOUR_EMAIL_ADDRESS(GMAIL)
MAIL_PASSWORD=ENTER_YOUR_GMAIL_PASSWORD
MAIL_ENCRYPTION=ssl
The MAIL_USERNAME and PASSWORD should be replaced with your Gmail Email address and Password respectively.
Since we are using Gmail SMTP, we need to change some security settings on our Google account, to give access to less secured applications.
Configure your Google Account
Login to your Google Email Account and click on Google Account Button.
Once you are on My Account Page then click on Security and scroll down to the bottom and you will find ‘Less secure app access’ settings. Click on the radio button to set it ON.

forget password not working in laravel 5

I tried to click on link forget password and it says email has been sent but I didn't receive email
I am using gmail smpt in db config
I have already tried to change the setting in .env file but still nothing
This is mail config
MAIL_DRIVER=mail
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
MAIL_USERNAME=username#gmail.com
MAIL_PASSWORD=password
MAIL_ENCRYPTION=ssl
This isn't working it only says email has been sent but I didn't receive mail
I have also allowed in gmail to use Allow less secure apps: ON
so that app can directly send mail
You said you are using smpt driver. but in configuration you have set to mail.
So, you need to set MAIL_DRIVER from mail to smtp as given below:
'MAIL_DRIVER=smtp`.
Which password you are using ? Is that password which you are using to get login to gmail server ?
If yes then go to Myaccount of gmail then go to sign in and security and go to App password and generate password for Mail App and use that password.
May be that works for you. Same is working for me. Also change the following settings in your .env file.
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_ENCRYPTION=tls
I changed the value of MAIL_DRIVER from mail to sendmail in the .env file
MAIL_DRIVER=sendmail
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
MAIL_USERNAME=email#gmail.com
MAIL_PASSWORD=password
MAIL_ENCRYPTION=ssl
In account setting of gmail allow unsecured app to send mail works for me

Resources