Here is the function of activating mail after the demo user has registered.
After clicking on the registration, the system will automatically send an email to the registrant's email, and the registrant can activate the account by clicking on the link.
Configure the (. env) file in Laravel first
mail_driver=smtp//Driver mail_host=smtp.sina.com//mail server address mail_port=25//port Mail_username=183****[email protected]// Your e-mail mail_password=**********hai//your e-mail password mail_encryption=null
Then configure the (email.php) file in the Laravel
' From ' = [' address ' = ' 183****[email protected] ', ' name ' = ' book Mall '],
After that, I went to the controller to write the code.
$member = new Member (); $member->email = $email; $member->password = MD5 (' BK ' + $password); $member->save (); $uuid = Uuid::create (); $m 3_email = new M3email (); $m 3_email->to = $email; $m 3_email->cc = ' 183****[email protected] '; $m 3_email->subject = ' book Mall '; $m 3_email->content = ' Please click on the link within 24 hours to complete the verification, http://localhost/book/public/service/validate_email '. '? Member_id= '. $member->id. ' &code= '. $uuid; $tempEmail = new Tempemail (); $tempEmail->member_id = $member->id; $tempEmail->code = $uuid; $tempEmail->deadline = Date (' y-m-d h:i:s ', Time () +24*60*60); $tempEmail->save ();mail::send (' Email_register ', [' m3_email ' = $m 3_email],function ($m) use ($m 3_email) {$m->to ($m 3_ema Il->to, ' respectable user ')->cc ($m 3_email->cc)->subject ($m 3_email->subject); });//This piece of code is a method of the mail class
Using the mail sending feature in the Laravel framework