Skip to content
Advertisement

how can i send an email when user register but to the specific email in Laravel 8

I need when a user registers successfully to send notification email to the reference email field

the notification include one line text with link buttom and when he click on the buttom will redirect to my website

I need to send that notification to the referance_email field

public function create(array $input)
    {   $massage = ['tc_no_pasaport_no.unique'=> 'Sorry, internal error .',
        'phone.unique'=>'Sorry, internal error .' ];


        
       Validator::make($input, [
            'phone' => ['required', 'string', 'max:255','unique:users'],

            'name' => ['required', 'string', 'max:255'],
            'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
            
            'tc_no_pasaport_no' => ['required','max:11','unique:users'],
            'place_of_birth' => ['required'],
            'date_of_birth' => ['required'],
            'educational_status' => ['required','string'],
            'school_department' => ['required'],
            'address' => ['required'],
           



            'password' => $this->passwordRules(),
            'terms' => Jetstream::hasTermsAndPrivacyPolicyFeature() ? ['required', 'accepted'] : '',
        ],$massage)->validate();

        $users = User::where('email', '=', $input['email'])->first();
            if ($users === null) {
            return User::create([



            'name' => $input['name'],
            'email' => $input['email'],
            'phone' => $input['phone'],

            'password' => Hash::make($input['password']),
            'membership_status' =>'pasif',
            'membership_type' =>'standard',
            'last_activation_date' =>  Carbon::now(),
            'membership_end_date' =>  Carbon::now(),     
            'temporary_id' => random_int(1000000, 9999999),
            'tc_no_pasaport_no' => $input['tc_no_pasaport_no'],
            'place_of_birth' => $input['place_of_birth'],
            'date_of_birth' => $input['date_of_birth'],
            'educational_status' => $input['educational_status'],
            'school_department' => $input['school_department'],
            'Institution_and_unit' => $input['Institution_and_unit'],
            'address' => $input['address'],
            'referance_email' => $input['referance_email'],
            'letter_of_Intent'=>$input['letter_of_Intent'],
            'created_at' => Carbon::now(),


        ]);

    }

Advertisement

Answer

You can use PHP Mailer library to send email in PHP.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement