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


PHP mail_send函数代码示例

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


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

示例1: run

 /**
  * Build a nice email from the submitted data and send it
  */
 function run($data, $thanks, $argv)
 {
     global $ID;
     // get recipient address(es)
     $to = join(',', $argv);
     $sub = sprintf($this->getLang('mailsubject'), $ID);
     $txt = sprintf($this->getLang('mailintro') . "\n\n\n", dformat());
     foreach ($data as $opt) {
         $value = $opt->getParam('value');
         $label = $opt->getParam('label');
         switch ($opt->getFieldType()) {
             case 'fieldset':
                 $txt .= "\n====== " . hsc($label) . " ======\n\n";
                 break;
             default:
                 if ($value === null || $label === null) {
                     break;
                 }
                 $txt .= $label . "\n";
                 $txt .= "\t\t{$value}\n";
         }
     }
     global $conf;
     if (!mail_send($to, $sub, $txt, $conf['mailfrom'])) {
         throw new Exception($this->getLang('e_mail'));
     }
     return $thanks;
 }
开发者ID:nefercheprure,项目名称:dokuwiki-plugin-bureaucracy,代码行数:31,代码来源:mail.php

示例2: error

 function error($from, $msg)
 {
     $this->log(LOG_INFO, "Error: {$from} {$msg}");
     $headers['To'] = $from;
     $headers['Subject'] = _m('Error');
     return mail_send(array($from), $headers, $msg);
 }
开发者ID:himmelex,项目名称:NTW,代码行数:7,代码来源:imapmailhandler.php

示例3: mail_debug

function mail_debug($recipient = 'root@localhost', $sender = 'admin@localhost')
{
    global $phpmailer, $mail_administrators;
    ob_start();
    mail_send('RapidWebSMS - Send Mail Test.', 'This is a test.', $recipient, $sender, 'html');
    return ob_get_clean();
}
开发者ID:platform-project,项目名称:platform-project,代码行数:7,代码来源:phpmailer.php

示例4: defaultAction

    function defaultAction()
    {
        $subjects = array(1 => array('id' => 1, 'title' => s('General question')), 2 => array('id' => 2, 'title' => s('Bug report')), 3 => array('id' => 3, 'title' => s('Collaboration or partership')), 4 => array('id' => 4, 'title' => s('Idea')), 5 => array('id' => 5, 'title' => s('Other')));
        $html = '';
        $errors = array();
        $is_posted = request_int('is_posted');
        $jump_to = 'feedback_name';
        if ($is_posted) {
            if (!count($errors) && !request_str('email')) {
                $errors[] = s('Please, enter your email');
                $jump_to = 'feedback_email';
            }
            if (!count($errors) && request_str('email') && !filter_var(request_str('email'), FILTER_VALIDATE_EMAIL)) {
                $errors[] = s('Please, provide correct email address. For example: john@gmail.com');
                $jump_to = 'feedback_email';
            }
            if (!count($errors) && !request_str('message')) {
                $errors[] = s('Enter the message.');
                $jump_to = 'feedback_password';
            }
            if (!count($errors)) {
                $data = array('{name}' => request_str('name'), '{email}' => request_str('email'), '{subject}' => $subjects[request_int('subject_id')]['title'], '{message}' => request_str('message'));
                $message = str_replace(array_keys($data), array_values($data), 'Name: {name}
Email: {email}

Subject: {subject}

{message}


' . $_SERVER['REMOTE_ADDR'] . ' ' . date('r'));
                core::$sql->insert(array('message' => core::$sql->s($message), 'insert_stamp' => core::$sql->i(time())), DB . 'feedback');
                require_once '../mod/lib.mail.php';
                foreach (array('info@metro4all.ru') as $email) {
                    mail_send(request_str('name'), request_str('email'), $email, 'Metro4all.org - ' . $subjects[request_int('subject_id')]['title'], $message, false);
                }
                go(Core::$config['http_home'] . 'feedback/?action=ok');
            }
        }
        $page = new PageCommon(s('Feedback'));
        $html .= $page->start();
        $html .= '<div class="row"><div class="col-md-offset-2 col-md-8"><h2>' . s('Feedback') . '</h2>';
        if (count($errors)) {
            $html .= '<div class="alert alert-danger"><p>' . escape($errors[0]) . '</p></div>';
        }
        $form = new Form('feedback', false, 'post');
        $html .= '<div class="well">' . $form->start() . $form->addVariable('is_posted', 1) . $form->addString('name', s('Name'), $is_posted ? request_str('name') : '') . $form->addString('email', s('E-mail'), $is_posted ? request_str('email') : '', array('is_required' => true)) . $form->addSelect('subject_id', s('Subject'), $is_posted ? request_int('subject_id') : 1, array('data' => $subjects)) . $form->addText('message', s('Message'), $is_posted ? request_str('message') : '', array('is_required' => true, 'style' => 'height:200px')) . $form->submit(s('Send')) . '</div>';
        $html .= '<script> $(document).ready(function() { $("#' . $jump_to . '").focus(); }); </script>';
        $html .= '</div></div>';
        $html .= $page->stop();
        return $html;
    }
开发者ID:ivanovv,项目名称:metro4all,代码行数:52,代码来源:FeedbackController.php

示例5: service_mail_send

/**
 * メールの送信
 *
 * @param string $to
 * @param string $subject
 * @param string $message
 * @param array  $headers
 * @param array  $files
 *
 * @return bool
 */
function service_mail_send($to, $subject, $message, $headers = array(), $files = array())
{
    if ($GLOBALS['config']['mail_send'] === true) {
        return mail_send($to, $subject, $message, $headers);
    } else {
        $text = '――――――――――――――――――――' . "\n";
        $text .= 'to: ' . $to . "\n";
        $text .= '――――――――――――――――――――' . "\n";
        $text .= 'subject: ' . $subject . "\n";
        $text .= '――――――――――――――――――――' . "\n";
        $text .= $message;
        return file_put_contents(MAIN_APPLICATION_PATH . 'mails/' . localdate('YmdHis') . '_' . $to . '.txt', $text);
    }
}
开发者ID:refirio,项目名称:levis-members,代码行数:25,代码来源:mail.php

示例6: run

 /**
  * Build a nice email from the submitted data and send it
  */
 function run($fields, $thanks, $argv)
 {
     global $ID;
     $this->prepareLanguagePlaceholder();
     // get recipient address(es)
     $to = join(',', $argv);
     $replyto = array();
     $headers = null;
     $subject = sprintf($this->getLang('mailsubject'), $ID);
     $txt = sprintf($this->getLang('mailintro') . "\n\n\n", dformat());
     foreach ($fields as $opt) {
         /** @var syntax_plugin_bureaucracy_field $opt */
         $value = $opt->getParam('value');
         $label = $opt->getParam('label');
         switch ($opt->getFieldType()) {
             case 'fieldset':
                 $txt .= "\n====== " . hsc($label) . " ======\n\n";
                 break;
             case 'subject':
                 $subject = $label;
                 break;
             case 'email':
                 if (!is_null($opt->getParam('replyto'))) {
                     $replyto[] = $value;
                 }
                 /** fall through */
             /** fall through */
             default:
                 if ($value === null || $label === null) {
                     break;
                 }
                 $txt .= $label . "\n";
                 $txt .= "\t\t{$value}\n";
         }
         $this->prepareFieldReplacements($label, $value);
     }
     $subject = $this->replaceDefault($subject);
     if (!empty($replyto)) {
         $headers = mail_encode_address(join(',', $replyto), 'Reply-To');
     }
     global $conf;
     if (!mail_send($to, $subject, $txt, $conf['mailfrom'], '', '', $headers)) {
         throw new Exception($this->getLang('e_mail'));
     }
     return $thanks;
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:49,代码来源:mail.php

示例7: main_function

function main_function($tls, $smtpserver, $username, $password, $port, $auth)
{
    $msgarray = array();
    try {
        $mail = mail_send($tls, $smtpserver, $username, $password, $port, $auth);
        if ($mail === true) {
            insert_into_db($tls, $smtpserver, $username, $password, $port, $auth);
            $constantresult = writeMailSettingsconstants($tls, $port, $username, $password, $smtpserver, $auth);
            if ($constantresult === true) {
                $msgarray['result'] = 'send';
            } else {
                $msgarray['error'] = 'Some error occured';
            }
        } else {
            $msgarray['error'] = $mail;
        }
    } catch (PDOException $ex) {
        $msgarray['error'] = 'Some error occured. ' . $ex->getMessage();
    }
    return $msgarray;
}
开发者ID:rajbrt,项目名称:sentrifugo,代码行数:21,代码来源:step4.php

示例8: intval

    if (!isset($_SESSION['mail']['to']) && isset($_GET['id'])) {
        $_SESSION['mail']['to'] = intval(hesk_GET('id'));
    }
} else {
    $hesk_settings['mailtmp']['this'] = 'to';
    $hesk_settings['mailtmp']['other'] = 'from';
    $hesk_settings['mailtmp']['m_from'] = $hesklang['m_from'];
    if ($action != 'read') {
        $hesk_settings['mailtmp']['inbox'] = '<b><img src="../img/inbox.png" width="16" height="16" alt="' . $hesklang['inbox'] . '" title="' . $hesklang['inbox'] . '" border="0" style="border:none;vertical-align:text-bottom" /> ' . $hesklang['inbox'] . '</b>';
        $hesk_settings['mailtmp']['folder'] = '';
    }
}
/* What should we do? */
switch ($action) {
    case 'send':
        mail_send();
        break;
    case 'mark_read':
        mail_mark_read();
        break;
    case 'mark_unread':
        mail_mark_unread();
        break;
    case 'delete':
        mail_delete();
        break;
}
/* Print header */
require_once HESK_PATH . 'inc/header.inc.php';
/* Print main manage users page */
require_once HESK_PATH . 'inc/show_admin_nav.inc.php';
开发者ID:ermedita-xhafaj,项目名称:support,代码行数:31,代码来源:mail.php

示例9: respond

 function respond($from, $to, $response)
 {
     $headers['From'] = $to;
     $headers['To'] = $from;
     $headers['Subject'] = _('Command complete');
     return mail_send(array($from), $headers, $response);
 }
开发者ID:microcosmx,项目名称:experiments,代码行数:7,代码来源:mailhandler.php

示例10: mail_confirm_sms

/**
 * send a message to confirm a claim for an SMS number
 *
 * @param string $code     confirmation code
 * @param string $nickname nickname of user claiming number
 * @param string $address  email address to send the confirmation to
 *
 * @see common_confirmation_code()
 *
 * @return void
 */
function mail_confirm_sms($code, $nickname, $address)
{
    $recipients = $address;
    $headers['From'] = mail_notify_from();
    $headers['To'] = $nickname . ' <' . $address . '>';
    // TRANS: Subject line for SMS-by-email address confirmation message.
    $headers['Subject'] = _('SMS confirmation');
    // TRANS: Main body heading for SMS-by-email address confirmation message.
    // TRANS: %s is the addressed user's nickname.
    $body = sprintf(_("%s: confirm you own this phone number with this code:"), $nickname);
    $body .= "\n\n";
    $body .= $code;
    $body .= "\n\n";
    mail_send($recipients, $headers, $body);
}
开发者ID:microcosmx,项目名称:experiments,代码行数:26,代码来源:mail.php

示例11: useraura

     if (!$angkatan_lulus) {
         $error .= "Error: Formulir Angkatan Lulus belum diisi , silahkan ulangi.<br />";
     }
     if ($error) {
         $tengah .= '<div class="error">' . $error . '</div>';
     } else {
         $hasil1 = $koneksi_db->sql_query("INSERT INTO useraura (user, email, password , level, tipe, nama, alamat, propinsi, kota, telp, hp, angkatan_masuk, angkatan_lulus)VALUES('{$username}', '{$email}', '{$password}','User','aktif','{$nama}','{$alamat}','{$propinsi}','{$kota}','{$telp}','{$hp}','{$angkatan_masuk}','{$angkatan_lulus}')");
         if ($hasil1) {
             $subject = "Your Account Information";
             $header = $email_master;
             $message = "Your Account \r\n";
             $message .= "<br /><br />";
             $message .= "Username : " . $username . " <br>Password : " . $_POST['password'] . "";
             $message .= "<br />Please Don't Replay This Email, this is Automatic Email Because You Register in {$judul_situs} <br /><br />";
             $message .= "<br /><br /><br />Regard:<br /><br />Webmaster<br />";
             $sentmail = mail_send($email, $header, $subject, $message, 1, 1);
             $tengah .= '<div class="sukses">Please Login With Your Username and Your Password</div>';
             unset($_POST);
         }
     }
 }
 $username = !isset($username) ? '' : $username;
 $email = !isset($email) ? '' : $email;
 $password = !isset($passwordn) ? '' : $password;
 $rpassword = !isset($rpassword) ? '' : $rpassword;
 $nama = !isset($nama) ? '' : $nama;
 $alamat = !isset($alamat) ? '' : $alamat;
 $propinsi = !isset($propinsi) ? '' : $propinsi;
 $kota = !isset($kota) ? '' : $kota;
 $telp = !isset($telp) ? '' : $telp;
 $hp = !isset($hp) ? '' : $hp;
开发者ID:rekysda,项目名称:spinschool2,代码行数:31,代码来源:user.php

示例12: castVote

 /** 
  * ACTION: cast a new vote 
  * or save a changed vote
  * (If user is allowed to.)
  */
 function castVote()
 {
     $fullname = hsc(trim($_REQUEST['fullname']));
     $selected_indexes = $_REQUEST['selected_indexes'];
     // may not be set when all checkboxes are deseleted.
     if (empty($fullname)) {
         $this->template['msg'] = $this->getLang('dont_have_name');
         return;
     }
     if (empty($selected_indexes)) {
         if ($this->params['voteType'] == 'multi') {
             $selected_indexes = array();
             //allow empty vote only if voteType is "multi"
         } else {
             $this->template['msg'] = $this->getLang('select_one_option');
             return;
         }
     }
     //---- check if user is allowed to vote, according to 'auth' parameter
     //if AUTH_USER, then user must be logged in
     if ($this->params['auth'] == self::AUTH_USER && !$this->isLoggedIn()) {
         $this->template['msg'] = $this->getLang('must_be_logged_in');
         return;
     }
     //if AUTH_IP, then prevent duplicate votes by IP.
     //Exception: If user is logged in he is always allowed to change the vote with his fullname, even if he is on another IP.
     if ($this->params['auth'] == self::AUTH_IP && !$this->isLoggedIn() && !isset($_REQUEST['change__vote'])) {
         foreach ($this->doodle as $existintFullname => $userData) {
             if (strcmp($userData['ip'], $_SERVER['REMOTE_ADDR']) == 0) {
                 $this->template['msg'] = sprintf($this->getLang('ip_has_already_voted'), $_SERVER['REMOTE_ADDR']);
                 return;
             }
         }
     }
     //do not vote twice, unless change__vote is set
     if (isset($this->doodle["{$fullname}"]) && !isset($_REQUEST['change__vote'])) {
         $this->template['msg'] = $this->getLang('you_voted_already');
         return;
     }
     //check if change__vote is allowed
     if (!empty($_REQUEST['change__vote']) && !$this->isAllowedToEditEntry($fullname)) {
         $this->template['msg'] = $this->getLang('not_allowed_to_change');
         return;
     }
     if (!empty($_SERVER['REMOTE_USER'])) {
         $this->doodle["{$fullname}"]['username'] = $_SERVER['REMOTE_USER'];
     }
     $this->doodle["{$fullname}"]['choices'] = $selected_indexes;
     $this->doodle["{$fullname}"]['time'] = time();
     $this->doodle["{$fullname}"]['ip'] = $_SERVER['REMOTE_ADDR'];
     $this->writeDoodleDataToFile();
     $this->template['msg'] = $this->getLang('vote_saved');
     //send mail if  $params['adminMail'] is filled
     if (!empty($this->params['adminMail'])) {
         $subj = "[DoodlePlugin] Vote casted by {$fullname} (" . $this->doodle["{$fullname}"]['username'] . ')';
         $body = 'User has casted a vote' . "\n\n" . print_r($this->doodle["{$fullname}"], true);
         mail_send($this->params['adminMail'], $subj, $body, $conf['mailfrom']);
     }
 }
开发者ID:learningendless,项目名称:web-wiki,代码行数:64,代码来源:syntax.php

示例13: empty

 $mod_aexpres_login = empty($_POST['mod_aexpres_login']) ? '' : check_string($_POST['mod_aexpres_login'], 'string');
 $mod_mail_login = empty($_POST['mod_mail_login']) ? '' : check_string($_POST['mod_mail_login'], 'email');
 // -
 unset($sprav_data, $areaArray, $postArray, $gildArray, $date_expl);
 // Удаление временных переменных
 // -- end ENV -- //
 // ----- BEGIN ----- //
 switch ($action) {
     case 'add':
         if ($stage == 'save') {
             $query_add = "INSERT INTO users(date_add,fio1,fio2,fio3,birthday,photo,post_id,area_id,gild_id,status,comment,admin_add_id) VALUES (NOW(),'" . $fio1 . "','" . $fio2 . "','" . $fio3 . "'," . $birthday . ",'" . $photoname . "'," . $post_id . "," . $area_id . "," . $gild_id . ",1,'" . $comment . "',(SELECT id from admins WHERE login='" . $admin . "'))";
             if (write_data_to_db($query_add, 'insert')) {
                 $msg = 'Заявка отправлена';
                 $msg_class = 'success';
                 $msg_mail = "Сотрудник " . $fio1 . ' ' . $fio2 . ' ' . $fio3 . " принят на должность " . $posts[$post_id] . " с " . date('d.m.Y') . "г." . $cfg_mail_sign;
                 mail_send($cfg_mailto, "Новый сотрудник: " . $fio1 . " " . $fio2 . " " . $fio3, $msg_mail);
             } else {
                 $msg = 'Ошибка!';
                 $msg_class = 'failed';
             }
         }
         $page_name = 'Добавление нового сотрудника';
         include "./forms/header.html";
         include "./forms/uedit.php";
         break;
     case 'edit':
         if ($stage == 'save' and $uid != '') {
             if ($permission_id == 1) {
                 $query_edit_save = "UPDATE users SET date_mod=NOW(),fio1='" . $fio1 . "',fio2='" . $fio2 . "',fio3='" . $fio3 . "',birthday=" . $birthday . ",photo='" . $photoname . "',post_id=" . $post_id . ",area_id=" . $area_id . ",gild_id=" . $gild_id . ",comment='" . $comment . "',admin_mod_id=(SELECT id from admins WHERE login='" . $admin . "') WHERE id=" . $uid;
                 if (write_data_to_db($query_edit_save, 'update')) {
                     $msg = 'Данные сохранены';
开发者ID:progervlad,项目名称:utils,代码行数:31,代码来源:index.php

示例14: notify

/**
 * Sends a notify mail on page change
 *
 * @param  string  $id       The changed page
 * @param  string  $who      Who to notify (admin|subscribers)
 * @param  int     $rev      Old page revision
 * @param  string  $summary  What changed
 * @param  boolean $minor    Is this a minor edit?
 * @param  array   $replace  Additional string substitutions, @KEY@ to be replaced by value
 *
 * @author Andreas Gohr <andi@splitbrain.org>
 */
function notify($id, $who, $rev = '', $summary = '', $minor = false, $replace = array())
{
    global $lang;
    global $conf;
    // decide if there is something to do
    if ($who == 'admin') {
        if (empty($conf['notify'])) {
            return;
        }
        //notify enabled?
        $text = rawLocale('mailtext');
        $to = $conf['notify'];
        $bcc = '';
    } elseif ($who == 'subscribers') {
        if (!$conf['subscribers']) {
            return;
        }
        //subscribers enabled?
        if ($conf['useacl'] && $_SERVER['REMOTE_USER'] && $minor) {
            return;
        }
        //skip minors
        $bcc = subscriber_addresslist($id);
        if (empty($bcc)) {
            return;
        }
        $to = '';
        $text = rawLocale('subscribermail');
    } elseif ($who == 'register') {
        if (empty($conf['registernotify'])) {
            return;
        }
        $text = rawLocale('registermail');
        $to = $conf['registernotify'];
        $bcc = '';
    } else {
        return;
        //just to be safe
    }
    $text = str_replace('@DATE@', date($conf['dformat']), $text);
    $text = str_replace('@BROWSER@', $_SERVER['HTTP_USER_AGENT'], $text);
    $text = str_replace('@IPADDRESS@', $_SERVER['REMOTE_ADDR'], $text);
    $text = str_replace('@HOSTNAME@', gethostbyaddr($_SERVER['REMOTE_ADDR']), $text);
    $text = str_replace('@NEWPAGE@', wl($id, '', true), $text);
    $text = str_replace('@PAGE@', $id, $text);
    $text = str_replace('@TITLE@', $conf['title'], $text);
    $text = str_replace('@DOKUWIKIURL@', DOKU_URL, $text);
    $text = str_replace('@SUMMARY@', $summary, $text);
    $text = str_replace('@USER@', $_SERVER['REMOTE_USER'], $text);
    foreach ($replace as $key => $substitution) {
        $text = str_replace('@' . strtoupper($key) . '@', $substitution, $text);
    }
    if ($who == 'register') {
        $subject = $lang['mail_new_user'] . ' ' . $summary;
    } elseif ($rev) {
        $subject = $lang['mail_changed'] . ' ' . $id;
        $text = str_replace('@OLDPAGE@', wl($id, "rev={$rev}", true), $text);
        require_once DOKU_INC . 'inc/DifferenceEngine.php';
        $df = new Diff(split("\n", rawWiki($id, $rev)), split("\n", rawWiki($id)));
        $dformat = new UnifiedDiffFormatter();
        $diff = $dformat->format($df);
    } else {
        $subject = $lang['mail_newpage'] . ' ' . $id;
        $text = str_replace('@OLDPAGE@', 'none', $text);
        $diff = rawWiki($id);
    }
    $text = str_replace('@DIFF@', $diff, $text);
    $subject = '[' . $conf['title'] . '] ' . $subject;
    mail_send($to, $subject, $text, $conf['mailfrom'], '', $bcc);
}
开发者ID:manishkhanchandani,项目名称:mkgxy,代码行数:82,代码来源:common.php

示例15: _save

 function _save($data, $hlp)
 {
     global $ID;
     // on the first run for this page, clean up
     if (!isset($this->run[$ID])) {
         $hlp->cleanPageTasks($ID);
         $this->run[$ID] = true;
     }
     if ($data['state'] !== DOKU_LEXER_EXIT) {
         return;
     }
     // save the task data - only when not saved yet.
     if (in_array($data['task']['md5'], $this->saved)) {
         return;
     }
     $hlp->saveTask($data['task'] + array('page' => $ID, 'pos' => ++$this->position));
     $this->saved[] = $data['task']['md5'];
     global $auth;
     if ($auth !== null && isset($data['task']['user']) && (!isset($_SERVER['REMOTE_USER']) || $data['task']['user'] !== $_SERVER['REMOTE_USER']) && (!isset($this->oldTasks[$data['task']['md5']]) || $this->oldTasks[$data['task']['md5']]['user'] !== $data['task']['user'])) {
         global $conf;
         $info = $auth->getUserData($data['task']['user']);
         mail_send($info['name'] . ' <' . $info['mail'] . '>', '[' . $conf['title'] . '] ' . sprintf($this->getLang('mail_subj'), $data['task']['text']), sprintf(file_get_contents($this->localFN('mail_body')), isset($_SERVER['REMOTE_USER']) ? $_SERVER['REMOTE_USER'] : $this->getLang('someone'), $data['task']['text'], isset($data['task']['date']) ? $data['task']['date'] : $this->getLang('nodue'), wl($ID, '', true, '&') . '#plgdo__' . $data['task']['md5']), $conf['mailfrom']);
     }
 }
开发者ID:rauschen,项目名称:do,代码行数:24,代码来源:do.php


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