邮件都能做什么
1.邮件找回密码2.邮件激活账号3.邮件发送验证码4.公司的邮件服务器,可以作为项目管理系统5.邮件推送链接 促销,新品 等信息
6.推送一些提醒消息
了解一个概念
邮件营销
在yii2中 操作phpmailer
首先是加载我们邮箱的组件‘mailer’ => [
‘class’ => ‘yii\swiftmailer\Mailer’,// send all mails to a file by default. You have to set// ‘useFileTransport’ to false and configure a transport// for the mailer to send real emails.‘useFileTransport’ => false,‘transport’ => [‘class’ => ‘Swift_SmtpTransport’,‘host’ => ‘smtp.qq.com’,‘username’ => ‘***’,‘password’ => ‘**’,‘port’ => ’25’,‘encryption’ => ‘tls’,],
‘messageConfig’=>[‘charset’=>’UTF-8’,‘from’=>[‘***’=>’admin’]],]public function actionSendmail(){
//加载配置的组件$mail = Yii::$app->mailer->compose();//要发给谁$mail->setTo(‘1054762539@qq.com’);//标题 主题$mail->setSubject(“test”);//内容$mail->setHtmlBody(“我我我我”);if ($mail->send())echo “成功”;elseecho “失败”;die();