本文整理汇总了PHP中smtp::bind方法的典型用法代码示例。如果您正苦于以下问题:PHP smtp::bind方法的具体用法?PHP smtp::bind怎么用?PHP smtp::bind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类smtp
的用法示例。
在下文中一共展示了smtp::bind方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smtp
echo "Send email messages\n";
$mail = new smtp();
$mail->subject = $eSubject;
// заголовок письма
$mail->message = $eMessage;
// текст письма
$mail->recipient = '';
// свойство 'получатель' оставляем пустым
$spamid = $mail->send('text/html');
if (!$spamid) {
die('Failed!');
}
// с этого момента рассылка создана, но еще никому не отправлена!
// допустим нам нужно получить список получателей с какого-либо запроса
$i = 0;
$mail->recipient = array();
$res = $master->query($sql);
while ($row = pg_fetch_assoc($res)) {
$mail->recipient[] = array('email' => $row['email'], 'extra' => array('first_name' => $row['uname'], 'last_name' => $row['usurname'], 'USER_LOGIN' => $row['login']));
if (++$i >= 30000) {
$mail->bind($spamid);
$mail->recipient = array();
$i = 0;
}
$cnt++;
}
if ($i) {
$mail->bind($spamid);
$mail->recipient = array();
}
echo "OK. Total: {$cnt} users\n";
示例2: getMailerSend
//.........这里部分代码省略.........
} else {
if ($message['filter_frl'] > 0) {
$sql = $sql_frl_recipient;
} else {
if ($message['filter_emp'] > 0) {
$sql = $sql_emp_recipient;
}
}
}
}
}
// Отправка личным сообщением
if ($message['type_sending'][0] == 1) {
$this->log->write("Initialization sending to personal messages\n");
$msg_attached = "'{}'";
if (count($attached) > 0) {
$msg_attached = "'{" . implode(", ", $attached) . "}'";
}
$msgid = $PLDB->val("SELECT masssend({$message['user_id']}, '{$message['message']}', {$msg_attached}, '')");
}
// Отправка по почте
if ($message['type_sending'][1] == 1) {
$this->log->write("Initialization sending to email\n");
$mail = new smtp();
$mail->prepare = true;
$mail->subject = $message['subject'];
$mail->message = $this->getMailContent($message['message']);
$mail->recipient = '';
$spamid = $mail->send('text/html', $attached);
$mail->recipient = array();
}
// Если ничего не выбрано отправляем обоими способами
if ($message['type_sending'][0] == 0 && $message['type_sending'][1] == 0) {
$this->log->write("Initialization sending to personal messages\n");
$msg_attached = "'{}'";
if (count($attached) > 0) {
$msg_attached = "'{" . implode(", ", $attached) . "}'";
}
$msgid = $PLDB->val("SELECT masssend({$message['user_id']}, '{$message['message']}', {$msg_attached}, '')");
// ------------------------------ //
$this->log->write("Initialization sending to email\n");
$mail = new smtp();
$mail->prepare = true;
$mail->subject = $message['subject'];
$mail->message = $this->getMailContent($message['message']);
$mail->recipient = '';
$spamid = $mail->send('text/html', $attached);
$mail->recipient = array();
}
$i = 0;
$cnt_emp = 0;
$cnt_frl = 0;
if ($message['filter_file']) {
while ($user = $this->parseExtraList($message['filter_file'], $i)) {
$cnt_frl += count($user);
$users = array();
foreach ($user as $u) {
$users[] = (int) $u['uid'];
}
if ($msgid) {
$PLDB->query("SELECT masssend_bind(?, ?, ?a)", $msgid, $message['user_id'], $users);
}
if ($spamid) {
$mail->recipient = array_map(array("mailer", "array2send"), $user);
$mail->bind($spamid);
$mail->recipient = array();
}
$i = $i + self::MAX_SEND_USERS;
}
$this->log->write("Complite binding users (parsed users = {$cnt_frl})\n");
} else {
while ($users = $DB->col($sql . " LIMIT " . self::MAX_SEND_USERS . " OFFSET ?", $i)) {
$user = $DB->rows("SELECT uid, login, uname, usurname, role, email FROM users WHERE uid IN (?l)", $users);
$emp = array_filter($user, create_function('$a', 'return (substr($a["role"], 0, 1) == 1);'));
$frl = array_filter($user, create_function('$a', 'return !(substr($a["role"], 0, 1) == 1);'));
$cnt_emp += count($emp);
$cnt_frl += count($frl);
if ($msgid) {
$PLDB->query("SELECT masssend_bind(?, ?, ?a)", $msgid, $message['user_id'], $users);
}
if ($spamid) {
$mail->recipient = array_map(array("mailer", "array2send"), $user);
$mail->bind($spamid);
$mail->recipient = array();
}
$i = $i + self::MAX_SEND_USERS;
}
$this->log->write("Complite binding users (employer = {$cnt_emp}, freelancer = {$cnt_frl})\n");
}
$PLDB->query("SELECT masssend_commit(?, ?)", $msgid, $message['user_id']);
// Обновляем данные рассылки
$this->update(array("status_sending" => 1, "status_message" => 1, "real_date_sending" => "NOW()", "msgid" => (int) $msgid, "spamid" => (int) $spamid, "count_rec_frl" => (int) $cnt_frl, "count_rec_emp" => (int) $cnt_emp), $message['id']);
if ($message['type_regular'] > 1) {
$this->updateRegularDate($message['type_regular'], $message['id']);
}
unset($mail, $msgid, $spamid);
$this->log->write("\n-----------------------------------------------------------------------\n");
}
$this->log->write("Complite sending messages\n");
}
示例3: smtp
Зайдите, пожалуйста, на страницу <a href="https://www.fl.ru/remind/">восстановления пароля</a> и запросите ссылку для изменения пароля.
<br/><br/>
Также, для повышения безопасности вашего аккаунта, привяжите свой аккаунт к соцсети <br/>
и воспользуйтесь двухэтапной аутентификацией - http://feedback.fl.ru/topic/683170-dvuhetapnaya-autentifikatsiya-cherez-sotsseti/
<br/><br/>
С уважением, <br/>
команда <a href="https://www.fl.ru">FL.ru</a>
';
//------------------------------------------------------------------------------
$mail = new smtp();
$mail->subject = $subject;
$mail->message = $message;
$mail->recipient = '';
$spamid = $mail->send('text/html');
if (!$spamid) {
die("Failed!\n");
}
$mail->recipient = array();
$users = $DB->rows('
SELECT DISTINCT uid, uname, usurname, login, email
FROM users WHERE uid IN(?l)
', $uids);
if (!$users) {
die('Users not found.');
}
foreach ($users as $user) {
$mail->recipient[] = array('email' => $user['uname'] . ' ' . $user['usurname'] . ' [' . $user['login'] . '] <' . $user['email'] . '>', 'extra' => array('USER_NAME' => $user['uname'], 'USER_SURNAME' => $user['usurname'], 'USER_LOGIN' => $user['login']));
}
$mail->bind($spamid, true);
$cnt = count($users);
echo "OK. Total: {$cnt} users\n";
示例4: smtp
//$cnt = $mail->NewProj2($users);
//var_dump($cnt);
//print_r($GLOBALS['TESTERS_MAIL']);
//exit;
$mail = new smtp();
$mail->subject = 'Тема письма - проверка рассылки';
$mail->message = 'Это тело письма';
$mail->recipient = '';
$spamid = $mail->send('text/html');
if (!$spamid) {
die("Failed!\n");
}
$mail->recipient = array();
$rows[] = array('uname' => 'Алексей', 'usurname' => 'Казаков', 'email' => 'dezinger@gmail.com');
$rows[] = array('uname' => 'Алексей', 'usurname' => 'Казаков', 'email' => 'kazakov@fl.ru');
$rows[] = array('uname' => 'Алексей', 'usurname' => 'Казаков', 'email' => 'kazakov@free-lance.ru');
$rows[] = array('uname' => 'Алексей', 'usurname' => 'Казаков', 'email' => 'ak_soft@list.ru');
$rows[] = array('uname' => 'Алексей', 'usurname' => 'Казаков', 'email' => 'ddezinger@yandex.ru');
/*
$rows[] = array(
'uname' => 'Алексей',
'usurname' => 'Казаков',
'email' => 'yabrus@mail.ru'
);
*/
foreach ($rows as $row) {
$mail->recipient[] = array('email' => $row['email']);
}
$res = $mail->bind($spamid);
var_dump($res);
exit;