After a period of use, found in the project many places need to use user authentication, SMS verification and mailbox verification as the mainstream trend, wheat summed up if the Laravel framework to implement the sending mail function, will be more on how to implement SMS verification later on.
Under the. env file
1. Configuring the Laravel File
MAIL_DRIVER=SMTP//SMTP method recommended
Mail_host=smtp.163.com//Suggested use 163 mailbox QQ mailbox will have an error
MAIL_PORT=25//SMTP defaults to 25
Mail_username=null//Own 163 account
Mail_password=null//Client password
Mail_encryption=null
.
2. Modify the config/email.php file in the
' From ' + [' address ' = null, ' name ' = null],//not indicated on the manual, but the actual application if the Addredd=>null is error, need to write their own 163 address
3. Register 163 mailbox and make email account settings pop3/smtp/imap to open and activate the authorization code and verify the phone
4. Refer to the e-mail sent in the Laravel manual
It is important to note that the use mail must be referenced first when the controller refers to a message being sent
? ? ? ? send a message test
? ? ? ? set in the route
? ? ? ? write methods in the controller
? ? ? ? ? ? ? ? ? ? ? ? where
? ? ? ? ? ? ? ? ? ? ? ? 1:mail::raw is the delivery of native data, and other ways of sending content are provided in the manual;
? ? ? ? ? ? ? ? ? ? ? ? ? 2. $message->subjuet ("); is the title of the file
? ? ? ? ? ? ? ? ? ? ? ? ? 3. $message->to (); Send to whom
? ? ?
This is a $message
list of methods that can be used in a message generator instance:
$message->From($address,$name=Null);$message->Sender($address,$name=Null);$message->To($address,$name=Null);$message->Cc($address,$name=Null);$message->Bcc($address,$name=Null);$message->ReplyTo($address,$name=Null);$message->Subject($subject);$message->Priority($level);$message->Attach($pathToFile,Array$options=[]);Append a file to the original $data string ...$message->attachdata ( $data $name array $options = []; Get the underlying Swiftmailer message instance ... $message ->getswiftmessage (
? ? ? ? ? ? ? ? ? ? ?
? ? ? ? ?
[Mr. MAK] Implement Mailbox validation---Send mail in the Laravel framework