<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                [TOC] # 使用 郵件功能基于swiftMailer函數庫之上,提供了簡潔的API 配置config/mail.php ~~~ //支持這些驅動 Supported: "smtp", "mail", "sendmail", "mailgun", "mandrill", | "ses", "sparkpost", "log" ~~~ 發件人的全局配置 ~~~ 'from'=>[ 'address'=>env('MAIL_FROM_ADDRESS','default'), 'name'=>env('MAIL_FROM_NAME','default'), ] ~~~ 在.env文件里面可以配置這些 ~~~ MAIL_DRIVER=smtp MAIL_HOST=smtp.163.com //郵件主機 MAIL_PORT=25 //端口 MAIL_USERNAME=15557105721@163.com MAIL_PASSWORD=xxx MAIL_ENCRYPTION=ssl //協議 ~~~ 然后在控制器寫個方法 ~~~ public function mail() { //use Mail; Mail::raw('郵件內容-測試',function($message) { //第一個形參郵件內容 $message->from('15557105721@163.com','jdxia'); //1是發件人 2名字 $message->subject('郵件主題-測試'); //郵件主題 $message->to('825455423@qq.com'); //發送給誰 }); } ~~~ # 發送帶附件的郵件 有時候需要給運營定時發送表格數據,方式是定時跑程序將數據生成一個 excel 然后郵件發送到運營郵箱,這里用 laravel 來處理. 安裝 maatwebsite/excel ~~~ composer reuqire maatwebsite/excel ~~~ 下載 excel ~~~ $titles = [ '用戶ID', '用戶昵稱', '公司名稱', '銷售', '功能版本', '次數', '最高', '消耗', '剩余', '時間' ]; //使用 Excel::create $data_arr=[$titles,['user_id'=>100,'nick_name'=>'xxx','company'=>'百度','seller_name'=>'老王','user_type'=>1,'times'=>666,'top'=>100,'flows'=>88,'rest'=>123,'time'=>date('YmdHis')]];//從數據庫讀取的結果 //http://www.maatwebsite.nl/laravel-excel/docs/export \Excel::create('excel', function($excel) use($data_arr){ $excel->sheet('Sheetname', function($sheet) use($data_arr) { $sheet->fromArray($data_arr, null, 'A1', false, false); }); })->store('xlsx',storage_path('excel/exports')); ~~~ 發送郵件 ~~~ // https://docs.golaravel.com/docs/5.0/mail/ 郵件配置參考 #cat .env MAIL_DRIVER=smtp MAIL_HOST=smtp.exmail.qq.com MAIL_PORT=25 MAIL_USERNAME=xxx@xxx.com MAIL_PASSWORD=xxx #cat config/mail.php //模板文件 #cat resources/views/emails/attachment.balde.php 附件內容:{{$content}} <br> 發送時間:{{date('Y-m-d H:i:s')}} //重試 3次 $tryTimes=3; do { $email='xxx@xx.com'; $attachments=['file'=>storage_path('excel/exports').'/excel.xlsx'];//上面下載的 excel 附件 $subject='mail'; $cc='xxx@xx.com';//抄送郵件 $sendResult = \Mail::send('emails.attachment', ['content' => '發送內容'], function ($message) use ($email, $attachments, $subject, $cc) { $message->to($email)->subject($subject); foreach ($attachments as $alias => $attachment) { $ext = pathinfo($attachment)['extension']; $message->attach($attachment, ['as' => "=?UTF-8?B?" . base64_encode($alias) . "?=." . $ext]);// } if (!empty($cc)) { $message->cc($cc); } }); $tryTimes--; } while ($sendResult == 0 && $tryTimes); dd($sendResult);//發送成功 2 ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看