PHP code example of uguranyum / yii2-manual-sendmail-command
1. Go to this page and download the library: Download uguranyum/yii2-manual-sendmail-command library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
uguranyum / yii2-manual-sendmail-command example snippets
$users = Yii::$app->db2->createCommand('SELECT * FROM `users`')->queryAll();
foreach($users as $user)
{
$sendmail = new Sendmail();
$email = $user['email'];
$special_id = $user['id'];
$template = 10; // Your template number. You can make false...
$create_date = time(); // Created user date.
$password = rand(9999999,99999999999); // Create simple random password
$verification_code = $sendmail->generateVerificationCode(10); //if you need just help.
Yii::$app->db2->createCommand()->update('users', [
'password' => md5($password), //new md5 password
'verification_code' => $verification_code, //new verification code
], 'id = '.$user['id'])->execute();
$json_values = json_encode(['username' => $user['username'], 'password' => $password ]);
$sendmail->saveDb($email, $special_id, $template, $json_values, $create_date);
}
$sendmail = new Sendmail();
$this->saveDb();
$sendmail->run();
//$sendmail->turnicateMailList();