How to manually resend email verification in Laravel? - laravel

I have an admin page on my site and I want an option to be able to manually resend an email verification, there are two purposes for this:
Test email verifications templates.
Debug user issues.
Does the user model have a method to do this?

If your User model implements the MustVerifyEmail interface, yes, you can manually send the notification using:
$user->sendEmailVerificationNotification();

Related

Laravel : Add notification class to send email to create new password on registration using fortify

My requirement is to send a new notification via email to create a new password on the new user registration using fortify.
I want to do it the same way how the reset password is done. And so far I have achieved to do it using the same sendPasswordResetNotification ie in the user model
public function sendPasswordResetNotification($token)
{
$this->notify(new SetNewUserPassword($token));
}
SetNewUserPassword is the new notification class to send an email to create a new password for first-time registration with a welcome message. And I am triggering it from fortify/CreateNewUser class after adding the user using
Password::sendResetLink(['email'=> $user->email]);
But with this, I am overwriting the default rest password notification email content which is in the core vendor folder.
How can I achieve both, sending different emails ie- the default one for reset password and the customized one for a set new password for new user. The reset link and everything else will be the same
Your valuable input will be very much appreciated.
I am not that Familiar with fortify, but i do imagine that the notification works a lot like the email so create a new notification class with it's own view.
something like
php artisan make:mail SendResetLinkNotification
and then something like
public function sendResetLink($token)
{
$this->notify(new SendResetLinkNotification($token));
}

Laravel 7 no Verification email sent after a user registers

I followed the instruction of the Laravel documentation 7x for Email Verification.
I didn't do it at the very beginning and before this I made changes to the the users table adding columns like firstnane, familyname, city etc.
Since then I could register correctly without any email verification.
Today I decided to add this functionality but it doesn't work.
The register process is still going on but there is no email sent and the user is directly logged.
I use the
MAIL_MAILER=log
in my .env and other mails are correctly sent and visible in the logs file.
Here is the auth routes
Auth::routes(['verify' => true]);
I have a email_verified_at column in the users table.
Any idea ?
Most likely your User model is not implementing the Illuminate\Contracts\Auth\MustVerifyEmail contract/interface.
use Illuminate\Contracts\Auth\MustVerifyEmail;
...
class User extends Model implements MustVerifyEmail
"Once this interface has been added to your model, newly registered users will automatically be sent an email containing an email verification link." - Laravel 7.x Docs - Email Verification - Model Preparation

Can Joomla send the user an email after admin approves them?

Problem is:
User registers at the side and gets a registration email with a
confirmation link which can be used. and
Admin gets an email notification of a newly registered user
Admin activates & enables the user
No notification email to the user is sent about his accounts activation
No hints in the logs. Mailserver is working as described. Tests with System emails active for users show no difference in the behavior. Also added true to $return = JFactory::getMailer()->sendMail($data['mailfrom'], $data['fromname'], $data['email'], $emailSubject, $emailBody, true); in registeration.php
Does this feature actually work? Any help in solving this would be much-appreatiated.
Using Joomla 3.9.15 and no external plugins for user-management.
Thanks in advance for your time.
Joomla distinguishes between user activation by link through email or via administration backend. In order to send an email to the user after the activation of the user account one needs to use the link from the email. Activation from the administration backend will not send an email to the user who's account was activated.

Access ForgotPasswordController when authorized

I am not very good at English so not sure if I can explain my status correctly.
Currently, I am building admin panel which allow users to reset their password. So in the admin panel, I select user and click 'reset password' button. Then, resetPassword notification email will be sent to specific users(by email).
I am trying to do this with ForgorPasswordController's sendResetLinkEmail function but it seems I can't access their once authorized.
How can I solve this problem?
Thanks
You don't (and probably shouldn't) use that controller.
It will be easier to create new controller for your admin panel page and use the built in helper:
https://laravel.com/api/5.8/Illuminate/Auth/Passwords/PasswordBroker.html#method_sendResetLink
That should be available through Password facade
use use Illuminate\Support\Facades\Password;
(...)
Password::sendResetLink($emailAddress, function (Message $message) {
$message->subject('Password Reset');
});

How to Send an Email Verification for a Created User?

I'm trying to use Laravel 5.7's new email verification feature. Let's say I'm logged in as Admin inside the admin panel and I want to:
Create a random user via admin panel.
Send an email verification to that created user's email.
How can I accomplish this with the new Laravel 5.7 email verification feature?
The built in verification scaffolding provides a notification to do this. You just need to ensure that the user's verified_at is set to null and then
use Iluminate\Auth\Notifications\VerifyEmail;
$user->notify(new VerifyEmail);
This will resend a new email with a signed URL.

Resources