当前位置: 首页>>代码示例>>PHP>>正文


PHP mb_send_mail函数代码示例

本文整理汇总了PHP中mb_send_mail函数的典型用法代码示例。如果您正苦于以下问题:PHP mb_send_mail函数的具体用法?PHP mb_send_mail怎么用?PHP mb_send_mail使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了mb_send_mail函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 public function run(User $user, $args)
 {
     $args = explode(' ', $args, 2);
     $userName = $args[0];
     if (!isset($args[1])) {
         RespondError::make($user, ['msg' => 'Вы не ввели сообщения']);
         return;
     }
     $text = $args[1];
     $properties = PropertiesDAO::create()->getByUserName($userName);
     if (!$properties->getId()) {
         RespondError::make($user, ['msg' => "{$userName} не зарегистрирован или имя введено не верно"]);
         return;
     }
     $address = UserDAO::create()->getById($properties->getUserId());
     $permissions = new UserActions($user->getUserDAO());
     $actions = $permissions->getAllowed($address);
     if (!in_array(UserActions::MAIL, $actions)) {
         RespondError::make($user, ['msg' => $user->getLang()->getPhrase('NoPermission')]);
         return;
     }
     //@TODO сделать отправку по крону
     //также надо ограничить частоту отправки
     $config = DI::get()->getConfig();
     $mailerName = 'СоциоЧат';
     $headers = "MIME-Version: 1.0 \n" . "From: " . mb_encode_mimeheader($mailerName) . "<" . $config->adminEmail . "> \n" . "Reply-To: " . mb_encode_mimeheader($mailerName) . "<" . $config->adminEmail . "> \n" . "Content-Type: text/html;charset=UTF-8\n";
     $topic = 'Для вас есть сообщение';
     $msg = "<h2>Вам пришло сообщение от пользователя {$user->getProperties()->getName()}</h2>";
     $msg .= '<p>' . htmlentities(strip_tags($text)) . '</p>';
     $msg .= '<hr>';
     $msg .= 'Вернуться в <a href="' . $config->domain->protocol . $config->domain->web . '">СоциоЧат</a>';
     mb_send_mail($address->getEmail(), $topic, $msg, $headers);
     RespondError::make($user, ['msg' => 'Сообщение отправлено!']);
     return ['Сообщение отправлено!', true];
 }
开发者ID:jackblackjack,项目名称:sociochat,代码行数:35,代码来源:Mail.php

示例2: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $issues = Issue::all();
     $checkIssueList = array();
     foreach ($issues as $issue) {
         $stockPricelInfos = $issue->stockPricelInfos()->where('average_75days', '!=', 0)->orderBy('acquire_at', 'DESC')->take($this->numberOfVectors)->get();
         if (count($stockPricelInfos) < 2) {
             continue;
         }
         $vectors = array();
         $i = 0;
         foreach ($stockPricelInfos as $stockPricelInfo) {
             $vectors[] = ['x' => count($stockPricelInfos) - $i, 'y' => $stockPricelInfo->average_75days];
             $i++;
         }
         $cls = new CalcLeastSquare($vectors);
         $stockPricelInfos[0]->gradient_75days = $cls->getGradient();
         $stockPricelInfos[0]->save();
         if ($stockPricelInfos[1]->gradient_75days < 0 && $stockPricelInfos[0]->gradient_75days >= 0) {
             $issue->price_up_to_date = $stockPricelInfos[0]->opening_price;
             $checkIssueList[] = $issue;
         }
     }
     if (!count($checkIssueList)) {
         return;
     }
     $mailBody = "";
     foreach ($checkIssueList as $issue) {
         $mailBody .= $issue->code . " " . $issue->name . " ¥" . number_format($issue->unit * $issue->price_up_to_date) . ' http://stocks.finance.yahoo.co.jp/stocks/chart/?code=' . $issue->code . "&ct=z&t=1y&q=c&l=off&z=m&p=s,m75,m25&a=v\n";
     }
     mb_send_mail($this->mailTo, '75日トレンド転換面柄', $mailBody);
 }
开发者ID:akira-takahashi-jp,项目名称:stock_crawler,代码行数:37,代码来源:CalcGradient.php

示例3: send

 /**
  * send, Envoie le mail
  *
  * @param Message $message
  * @throws InvalidArgumentException
  * @throws MailException
  * @return bool
  */
 public function send(Message $message)
 {
     if (empty($message->getTo()) || empty($message->getSubject()) || empty($message->getMessage())) {
         throw new InvalidArgumentException("Une erreur est survenu. L'expediteur ou le message ou l'object omit.", E_USER_ERROR);
     }
     if (isset($this->config['mail'])) {
         $section = $this->config['mail']['default'];
         if (!$message->fromIsDefined()) {
             $form = $this->config['mail'][$section];
             $message->from($form["address"], $form["username"]);
         } else {
             if (!Str::isMail($message->getFrom())) {
                 $form = $this->config['mail'][$message->getFrom()];
                 $message->from($form["address"], $form["username"]);
             }
         }
     }
     $to = '';
     $message->setDefaultHeader();
     foreach ($message->getTo() as $value) {
         if ($value[0] !== null) {
             $to .= $value[0] . ' <' . $value[1] . '>';
         } else {
             $to .= '<' . $value[1] . '>';
         }
     }
     $status = @mb_send_mail($to, $message->getSubject(), $message->getMessage(), $message->compileHeaders());
     return (bool) $status;
 }
开发者ID:papac,项目名称:framework,代码行数:37,代码来源:SimpleMail.php

示例4: mailDefault

 function mailDefault($template, $to, $data)
 {
     $arrayMail = array();
     $file = file($template);
     //Get values from template mail
     foreach ($file as $value) {
         if ($value != "") {
             list($key, $val) = explode("=>", $value);
             $key = trim($key);
             $val = trim($val);
             $arrayMail[$key] = $val;
         }
     }
     $subject = $arrayMail['subject'];
     $from = $arrayMail['from'];
     $body = $arrayMail['body'];
     $body = str_replace('\\r\\n', "\n", $body);
     //			$headers .= "MIME-Version: 1.0\r\n";
     //			$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
     //			$headers  .= "From: $from\r\n";
     //push value from in parameter to body mail
     foreach ($data as $key => $item) {
         $body = str_replace('{$' . $key . '}', $item, $body);
     }
     //Execute send mail
     mb_language("Japanese");
     mb_internal_encoding("UTF-8");
     if (mb_send_mail($to, $subject, $body, "From: " . $from)) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:trongloikt192,项目名称:Project_Wahanda_Alternative,代码行数:33,代码来源:sendMail.php

示例5: send

 /**
  * メール送信処理
  */
 public function send()
 {
     // 先ずはチェック
     $ret = $this->validation();
     // エラーがある場合は終了
     if ($ret['status']) {
         return $ret;
     }
     // 宛先作成
     $to = $this->createMailToString($this->to);
     // FROM作成
     if (empty($this->fromName)) {
         $this->header .= "From: {$this->from}\n";
     } else {
         $from_name = mb_encode_mimeheader(mb_convert_encoding($this->fromName, "JIS", "UTF-8"));
         $this->header .= "From: {$from_name} <{$this->from}>\n";
     }
     // CC作成
     $cc = $this->createMailToString($this->cc);
     if ($cc) {
         $this->header .= "Cc: {$cc}\n";
     }
     // メール送信処理
     if (mb_send_mail($to, $this->title, $this->body, $this->header)) {
         return $ret;
     } else {
         $ret['status'] = 1;
         @array_push($ret['messages'], '送信処理に失敗しました。');
         return false;
     }
 }
开发者ID:vunh1989,项目名称:evacorp2,代码行数:34,代码来源:Mail.php

示例6: send_attached_mail

 public static function send_attached_mail($to, $subject, $plain_message, $from, $attachment = null, $fileName = null, $attach_mime_type = null)
 {
     if ($attachment === null) {
         self::send_mail($to, $subject, $plain_message, $from);
     } else {
         $fileName = mb_encode_mimeheader(mb_convert_encoding(basename($fileName), "ISO-2022-JP", 'auto'));
         $from = mb_encode_mimeheader(mb_convert_encoding(basename($from), "ISO-2022-JP", 'auto'));
         //必要に応じて適宜文字コードを設定してください。
         mb_language('Ja');
         mb_internal_encoding('UTF-8');
         $boundary = '__BOUNDARY__' . md5(rand());
         $headers = "Content-Type: multipart/mixed;boundary=\"{$boundary}\"\n";
         $headers .= "From: {$from}<{$from}>\n";
         $headers .= "Reply-To: {$from}\n";
         $body = "--{$boundary}\n";
         $body .= "Content-Type: text/plain; charset=\"ISO-2022-JP\"\n";
         $body .= "\n{$plain_message}\n";
         $body .= "--{$boundary}\n";
         $body .= "Content-Type: {$attach_mime_type}; name=\"{$fileName}\"\n";
         $body .= "Content-Disposition: attachment; filename=\"{$fileName}\"\n";
         $body .= "Content-Transfer-Encoding: base64\n";
         $body .= "\n";
         $body .= chunk_split(base64_encode($attachment)) . "\n";
         $body .= "--{$boundary}--";
         $ret = mb_send_mail($to, $subject, $body, $headers);
         return $ret;
     }
 }
开发者ID:gammodoking,项目名称:kindle.server,代码行数:28,代码来源:Mail.php

示例7: send

 function send()
 {
     global $tpl, $opt, $login;
     if (!$this->template_exists($this->name . '.tpl')) {
         $tpl->error(ERROR_MAIL_TEMPLATE_NOT_FOUND);
     }
     $this->assign('template', $this->name);
     $optn['mail']['contact'] = $opt['mail']['contact'];
     $optn['page']['absolute_url'] = $opt['page']['absolute_url'];
     $optn['format'] = $opt['locale'][$opt['template']['locale']]['format'];
     $this->assign('opt', $optn);
     $this->assign('to', $this->to);
     $this->assign('from', $this->from);
     $this->assign('subject', $this->subject);
     $llogin['username'] = isset($login) ? $login->username : '';
     $this->assign('login', $llogin);
     $body = $this->fetch($this->main_template . '.tpl', '', $this->get_compile_id());
     // check if the target domain exists if the domain does not
     // exist, the mail is sent to the own domain (?!)
     $domain = mail::getToMailDomain($this->to);
     if (mail::is_existent_maildomain($domain) == false) {
         return false;
     }
     $aAddHeaders = array();
     $aAddHeaders[] = 'From: "' . $this->from . '" <' . $this->from . '>';
     if ($this->replyTo !== null) {
         $aAddHeaders[] = 'Reply-To: ' . $this->replyTo;
     }
     if ($this->returnPath !== null) {
         $aAddHeaders[] = 'Return-Path: ' . $this->returnPath;
     }
     $mailheaders = implode("\n", array_merge($aAddHeaders, $this->headers));
     return mb_send_mail($this->to, $opt['mail']['subject'] . $this->subject, $body, $mailheaders);
 }
开发者ID:RH-Code,项目名称:opencaching,代码行数:34,代码来源:mail.class.php

示例8: mail_to

 public static function mail_to($value, $mails)
 {
     //return md5($value);
     mb_language("japanese");
     mb_internal_encoding("utf-8");
     $email = mb_encode_mimeheader("チラシシステム") . "<zuo@it-art.jp>";
     $subject = $value["title"];
     $body = $value["text"];
     //$from = "lightbox@sdc";
     //ini_set( "SMTP", "localhost" );
     //ini_set( "smtp_port", 25 );
     //ini_set( "sendmail_from", $from );
     $bccs = implode(' ,', $mails);
     $header = "From: " . mb_encode_mimeheader("チラシシステム") . "<zuo@it-art.jp>";
     $header .= "\n";
     $header = "Bcc:" . $bccs;
     //$header ="Bcc:zuo@it-art.jp,zou@shift-jp.net";
     $header .= "\n";
     if (!@mb_send_mail(NULL, $subject, $body, $header)) {
         // echo "*********mb_send_mailエラー**************";
         return false;
     } else {
         //echo "*********sucess**************";
         return true;
     }
 }
开发者ID:BGCX262,项目名称:zuozhenshi-prego-svn-to-git,代码行数:26,代码来源:Class_MAIL.php

示例9: wpbl_notify

function wpbl_notify($comment_id, $reason, $harvest)
{
    global $wpdb, $wp_id, $url, $email, $comment, $user_ip, $comment_post_ID, $author, $tableposts;
    $tableposts = $wpdb->posts[$wp_id];
    $sql = "SELECT * FROM {$tableposts} WHERE ID='{$comment_post_ID}' LIMIT 1";
    $post = $wpdb->get_row($sql);
    if (!empty($user_ip)) {
        $comment_author_domain = gethostbyaddr($user_ip);
    } else {
        $comment_author_domain = '';
    }
    // create the e-mail body
    $notify_message = "A new comment on post #{$comment_post_ID} \"" . stripslashes($post->post_title) . "\" has been automatically deleted by the WPBlacklist plugin.\r\n\r\n";
    $notify_message .= "Author : {$author} (IP: {$user_ip} , {$comment_author_domain})\r\n";
    $notify_message .= "E-mail : {$email}\r\n";
    $notify_message .= "URL    : {$url}\r\n";
    $notify_message .= "Whois  : http://ws.arin.net/cgi-bin/whois.pl?queryinput={$user_ip}\r\n";
    $notify_message .= "Comment:\r\n" . stripslashes($comment) . "\r\n\r\n";
    $notify_message .= "Triggered by : {$reason}\r\n\r\n";
    // add harvested info - if there is any
    if (!empty($harvest)) {
        $notify_message .= "Harvested the following information:\r\n" . stripslashes($harvest);
    }
    // e-mail header
    $subject = '[' . stripslashes(get_settings('blogname')) . '] Automatically deleted: "' . stripslashes($post->post_title) . '"';
    $admin_email = get_settings("admin_email");
    $from = "From: {$admin_email}";
    // send e-mail
    if (function_exists('mb_send_mail')) {
        mb_send_mail($admin_email, $subject, $notify_message, $from);
    } else {
        @mail($admin_email, $subject, $notify_message, $from);
    }
    return true;
}
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:35,代码来源:blacklist.php

示例10: resultAction

 public function resultAction()
 {
     $post = $this->request->getPost();
     $email = $post["email"];
     $error = array();
     if ("" == $email) {
         array_push($error, "メールアドレスを入力してください");
     } else {
         $pre_user_id = uniqid(rand(100, 999));
         $userModel = new Users();
         $result = $userModel->addEmail(array($pre_user_id, $email));
         if (false == $result) {
             array_push($error, "データベースに登録できませんでした。");
         } else {
             mb_language("japanese");
             mb_internal_encoding("utf-8");
             $to = $email;
             $subject = "seapaメンバー登録URL";
             $message = "以下のURLよりメンバー登録を行ってください。\n" . "http://localhost/regist/input/{$pre_user_id}";
             $header = "From: mail.seapa@gmail.com";
             if (!mb_send_mail($to, $subject, $message, $header, '-f' . 'mail.seapa@gmail.com')) {
                 array_push($error, "メールが送信できませんでした。<a href='http://localhost/regist/input/{$pre_user_id}'>遷移先</a>");
             }
             $this->view->assign('email', $email);
         }
     }
 }
开发者ID:vastustone,项目名称:seapa,代码行数:27,代码来源:Pre_registController.php

示例11: sendRaw

    static function sendRaw($address, $subject, $body)
    {
        $headers = null;
        $from = SITE_EMAIL;
        if (!defined('DISABLE_EMAILS') || !DISABLE_EMAILS) {
            return mb_send_mail($address, $subject, $body, $headers, " -t -i -F " . SITE_NAME . " -f {$from}");
        } else {
            $dt = new DateTime();
            $date = $dt->format('D j M Y g:ia');
            $from = SITE_EMAIL;
            $msg = <<<EOF

From: {$from}
To: {$address}
Subject: {$subject}
Date: {$date}
{$headers}

{$body}

=======================================================
=======================================================

EOF;
            file_put_contents(ROOT_DIR . '/mail.log', $msg, FILE_APPEND);
            return true;
        }
    }
开发者ID:roc,项目名称:Borax,代码行数:28,代码来源:email.class.php

示例12: send

 public function send($email, $topic, $msg)
 {
     $config = DI::get()->getConfig()->mail;
     $mailerName = $config->name;
     $headers = "MIME-Version: 1.0 \n" . "From: " . mb_encode_mimeheader($mailerName) . "<" . $config->adminEmail . "> \n" . "Reply-To: " . mb_encode_mimeheader($mailerName) . "<" . $config->adminEmail . "> \n" . "Content-Type: text/html;charset=UTF-8\n";
     mb_send_mail($email, $topic, $msg, $headers);
 }
开发者ID:jackblackjack,项目名称:sociochat,代码行数:7,代码来源:Mail.php

示例13: noticePackageUploaded

 public function noticePackageUploaded(Package $pkg)
 {
     $app = $this->app;
     $package_url = mfwRequest::makeURL("/package?id={$pkg->getId()}");
     ob_start();
     include APP_ROOT . '/data/notice_mail_template.php';
     $body = ob_get_clean();
     $addresses = array();
     foreach ($this->rows as $r) {
         if ($r['notify']) {
             $addresses[] = $r['mail'];
         }
     }
     if (empty($addresses)) {
         return;
     }
     $subject = "New Package Uploaded to {$app->getTitle()}";
     $sender = Config::get('mail_sender');
     $to = $sender;
     $header = "From: {$sender}" . "\nBcc: " . implode(', ', $addresses);
     mb_language('uni');
     mb_internal_encoding('UTF-8');
     if (!mb_send_mail($to, $subject, $body, $header)) {
         throw new RuntimeException("mb_send_mail faild (pkg={$pkg->getId()}, {$pkg->getTitle()})");
     }
 }
开发者ID:kzfk,项目名称:emlauncher,代码行数:26,代码来源:InstallUser.php

示例14: sendMail

 /**
  * @see	\wcf\system\mail\MailSender::sendMail()
  */
 public function sendMail(Mail $mail)
 {
     if (MAIL_USE_F_PARAM) {
         return @mb_send_mail($mail->getToString(), $mail->getSubject(), $mail->getBody(), $mail->getHeader(), '-f' . MAIL_FROM_ADDRESS);
     } else {
         return @mb_send_mail($mail->getToString(), $mail->getSubject(), $mail->getBody(), $mail->getHeader());
     }
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:11,代码来源:PHPMailSender.class.php

示例15: mb_send_mail_2

function mb_send_mail_2($to, $subject, $content, $headers)
{
    global $debug_page;
    if ($debug_page) {
        echo "<pre>mail\nto: {$to}\nsubject: {$subject}\n{$content}</pre>";
    } else {
        mb_send_mail($to, $subject, $content, $headers);
    }
}
开发者ID:pawelzielak,项目名称:opencaching-pl,代码行数:9,代码来源:chowner.php


注:本文中的mb_send_mail函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。