Yii2 Send mail (configure QQ version)

Source: Internet
Author: User
Tags server port yii
1. Configure in config file
' Mailer ' = [             ' class ' = ' yii\Swiftmailer\mailer ',//server class
            ' Usefiletransport ' =>false,//This sentence must have, false send message , true just generate mail in the runtime folder, do not send mail              ' transport ' = > [                ' class ' = 'Swift_smtptransport ',//Use the class              ' host ' = ' smtp.qq.com ',//email service an address              ' Username ' + ' 1806001025@qq.com ',//e-mail address, send the mailbox ' password ' = '                *********** ',  //fill in your email password              ' port ' = > ' 465 ',//  server Port              ' encryption ' + ' SSL ',//encryption Method   ], ' messageconfig ' =>[                   ' charset ' = ' UTF-8 ',//code                  ' from ' =>[' 1806001025@qq.com ' [admin ']  //e-mail address and name displayed in the message                ],   ]

The above configuration needs to be configured according to your mailbox.

2: You can call the

        $FFF = Yii:: $app->mailer->compose ()        ->setfrom ([' 1806001025@qq.com ' = ' I see you as silly '])//and corresponding to the From field above  can write only one                        ->setto (' 429281869@qq.com ')                       ->setsubject (' dsfsfsddddddddddddddddddddddddddd ')                       - >settextbody (' sdfffffffffffffffffffffffffffff ')                       ->send ();

Copyright NOTICE: This article for Bo Master original article, there is the wrong place to welcome correct.

The above describes the YII2 send mail (Configure the QQ version), including e-mail, send mail, swift content, I hope the PHP tutorial interested in a friend helpful.

  • 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.