<commit_before><?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use Illuminate\Contracts\Mail\Mailer;

class SendEmails extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'email:send {user}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = '发送邮件给用户';

    protected $drip='xxx';
    protected $user=null;

    /**
     * Create a new command instance.
     *
     * @return void DripEmailer
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle(Mailer $mailer)
    {
//        $user = $this->user;
//        $mailer->send('emails.reminder',['user'=>$user],function($message) use ($user){
//            $message->to($user->email)->subject('新功能发布');
//        });


        $name = 'yongze';
        $to = '<EMAIL>';
        $flag = $mailer->send('emails.reminder',['name'=>$name],function($message) use($to) {
            $message ->to($to)->subject('邮件测试');
        });

        //发送纯文本邮件
        $mailer->raw('你好，我是PHP程序！', function ($message) use($to) {
            $message ->to($to)->subject('纯文本信息邮件测试');
        });


//        邮件中发送附件
        $image = 'http://p1.bpimg.com/567571/19b95d3639c6f6a2.png';
        $flag = $mailer->send('emails.attachment',['name'=>$name,'imgPath'=>$image],function($message) use($to){
            $message ->to($to)->subject('网络图片测试');
        });

        return ;


        $name = $this->ask('What is your name?');
        if ($this->confirm('Do you wish to continue? [y|N]')) {
            $bar = $this->output->createProgressBar(30);
            for ($i=30;$i>=0;$i--){
                $bar->advance();
                sleep(1);
            }

            $bar->finish();
            //
            $this->info($name);
        }else{
            $this->error($name);
        }
    }
}<commit_msg>sendemail<commit_after><?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use Illuminate\Contracts\Mail\Mailer;

class SendEmails extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'email:send {user}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = '发送邮件给用户';

    protected $drip='xxx';
    protected $user=null;

    /**
     * Create a new command instance.
     *
     * @return void DripEmailer
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle(Mailer $mailer)
    {
//        $user = $this->user;
//        $mailer->send('emails.reminder',['user'=>$user],function($message) use ($user){
//            $message->to($user->email)->subject('新功能发布');
//        });

        $bar = $this->output->createProgressBar(3);

        $name = 'yongze';
        $to = '<EMAIL>';
        $flag = $mailer->send('emails.reminder',['name'=>$name],function($message) use($to) {
            $message ->to($to)->subject('邮件测试');
        });
        $bar->advance();

        //发送纯文本邮件
        $output_nginx =$this->execShellWithPrettyPrint('ps aux|grep nginx');
        $output_php =$this->execShellWithPrettyPrint('ps aux|grep php');
        $output_mysql =$this->execShellWithPrettyPrint('ps aux|grep nginx');
        $msg = <<<EOF
监控 服务器:
===============
nginx:
{$output_nginx}
===============
php:
{$output_php}
===============
mysql:
{$output_mysql}
EOF;

        $mailer->raw($msg, function ($message) use($to) {
            $message ->to($to)->subject('纯文本信息邮件测试');
        });
        $bar->advance();

//        邮件中发送附件
        $image = 'http://p1.bpimg.com/567571/19b95d3639c6f6a2.png';
        $flag = $mailer->send('emails.attachment',['name'=>$name,'imgPath'=>$image],function($message) use($to){
            $message ->to($to)->subject('网络图片测试');
        });

        $bar->finish();
        return ;


        $name = $this->ask('What is your name?');
        if ($this->confirm('Do you wish to continue? [y|N]')) {
            $bar = $this->output->createProgressBar(30);
            for ($i=30;$i>=0;$i--){
                $bar->advance();
                sleep(1);
            }

            $bar->finish();
            //
            $this->info($name);
        }else{
            $this->error($name);
        }
    }

    /**
     * Exec sheel with pretty print.
     *
     * @param  string $command
     * @return mixed
     */
    public function execShellWithPrettyPrint($command)
    {
        $this->info('---');
        $this->info($command);
        $output = shell_exec($command);
        $this->info($output);
        $this->info('---');

        return $output;
    }
}
{'fraction_non_alphanumeric': 0.19032258064516128, 'fraction_numerical': 0.009879032258064515, 'mean_word_length': 2.01580547112462, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 71, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4535370', 'n_tokens_mistral': 1655, 'n_tokens_neox': 1650, 'n_words': 275}