Laravel sends an email. laravel sends an email to an instance.

Source: Internet
Author: User

Laravel sends an email. laravel sends an email to an instance.

Here, 163 is used as an example:

1 ,. env file configuration and mail. php configuration (used by default. env) 2 3 MAIL_DRIVER = smtp 4 MAIL_HOST = smtp.163.com 5 MAIL_PORT = 465 6 MAIL_USERNAME = Account 7 MAIL_PASSWORD = Authorization code 8 MAIL_ENCRYPTION = SSL 9 10 parameter description: 11 host is the host where the mailbox is located, for example, if we use a 163 mailbox, the corresponding value is smtp.163.com. If we use a QQ mailbox, the corresponding value is smtp.qq.com. 12 port is used to configure the mail sending service port number. For example, the default value is 25. If SMTP is set to use SSL encryption, this value is 465. 13 encryption indicates the encryption type. If it is set to null, it means no encryption is used, or it can be set to tls (port number is 25) or ssl. 14 username indicates the mailbox account, for example, yaojinbu@163.com15 password indicates the corresponding login password for the mailbox login. Note that you should enable POP3 | the key provided by the SMTP service in your QQ mailbox. 16 17 2. Send email 18 (use template) view emails under the root directory. blade. php19 $ name = 'wang baohua'; 20 $ flag = Mail: send ('elastic', ['name' => $ name], function ($ message) {21 $ to = '1970 @ qq.com '; 22 $ message-> to ($ to)-> subject ('mail test'); 23 }); 24 if ($ flag) {25 echo 'the email is sent successfully. Please check it! '; 26} else {27 echo' failed to send the email. Please try again! '; 28} 29 30 (plain text) 31 Mail: raw ('Hi, I'm a PHP program! ', Function ($ message) {32 $ to = '1970 @ qq.com'; 33 $ message-> to ($) -> subject ('text-only mail test'); 34 });

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.