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


PHP Email::addRecipient方法代码示例

本文整理汇总了PHP中Email::addRecipient方法的典型用法代码示例。如果您正苦于以下问题:PHP Email::addRecipient方法的具体用法?PHP Email::addRecipient怎么用?PHP Email::addRecipient使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Email的用法示例。


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

示例1: emailAdmin

 /**
  * Email admin
  * @param string $status Message status e.g. error, success, debug
  * @param string $msg Message to email
  * @param boolean $email Email to admin, default false
  * @return boolean
  */
 public static function emailAdmin($status, $msg)
 {
     // Check admin email constants are defined
     if (!defined('EMAIL_FROM')) {
         status::Output('ERROR', 'EMAIL_FROM not specified');
         return;
     }
     if (!defined('AUTHOR_NAME')) {
         status::Output('ERROR', 'AUTHOR_NAME not specified');
         return;
     }
     if (!defined('AUTHOR_EMAIL')) {
         status::Output('ERROR', 'AUTHOR_EMAIL not specified');
         return;
     }
     // Create email
     $email = new Email();
     if (defined('EMAIL_SMTP') && EMAIL_SMTP) {
         $email->setSMTPStream();
     } else {
         $email->setPHPMail();
     }
     // Set message
     $email->addHTML("\n\t\t\t<p>CLI email from " . EMAIL_DOMAIN . ":<br />\n\t\t\tstatus: " . $status . "<br />\n\t\t\tmessage: " . nl2br($msg) . "\n\t\t\t</p>\n\t\t");
     // Send to admin
     $email->addRecipient(AUTHOR_EMAIL, AUTHOR_NAME);
     if ($email->Send(EMAIL_FROM, 'CLI Message') && !\Sonic\Message::count('error')) {
         return TRUE;
     } else {
         return FALSE;
     }
 }
开发者ID:andyburton,项目名称:sonic-framework,代码行数:39,代码来源:CLI.php

示例2: testClearRecipients

 /**
  * Tests the `clearRecipients` method.
  *
  * @return void
  * @access public
  */
 public function testClearRecipients()
 {
     $this->assertIdentical($this->_object->getRecipients(), array());
     // Add a recipient and confirm we have one added.
     $this->_object->addRecipient('test@test.com');
     $this->assertIdentical(count($this->_object->getRecipients()), 1);
     // Clear the recipients and confirm it's gone.
     $this->_object->clearRecipients();
     $this->assertIdentical(count($this->_object->getRecipients()), 0);
 }
开发者ID:joebeeson,项目名称:mailer,代码行数:16,代码来源:Email.test.php

示例3: Email

 /**
  * Email the welcome message and return to the view account page
  */
 function send_email()
 {
     // Construct an Email
     $email = new Email();
     $email->setFrom($this->conf['company']['email'], $this->conf['company']['name']);
     $email->addRecipient($this->session['welcome_email']['email']);
     $email->setSubject($this->session['welcome_email']['subject']);
     $email->setBody($this->session['welcome_email']['email_body']);
     // Send the email
     if (!$email->send()) {
         // Error delivering invoice
         throw new SWUserException("[WELCOME_EMAIL_FAILED]");
     }
     // Return to view_account with a sucess message
     $this->setMessage(array("type" => "[WELCOME_SENT]"));
     $this->gotoPage("accounts_view_account", null, "account=" . $this->get['account']->getID());
 }
开发者ID:carriercomm,项目名称:NeoBill,代码行数:20,代码来源:WelcomeEmailPage.class.php

示例4: sendVerificationMail

 public static function sendVerificationMail($email, $mailVerificationToken)
 {
     $mailSubject = CONFIG_SITE_NAME . ': Verify your email address';
     $mailDomain = parse_url(CONFIG_ROOT_URL, PHP_URL_HOST);
     $mail = new Email(CONFIG_SITE_EMAIL, CONFIG_SITE_NAME, $mailSubject);
     $mail->addRecipient($email);
     $mail->addLine('Hello ' . self::getUserName() . ',');
     $mail->addLine('');
     $mail->addLine('Please open the following link in order to verify your email address on ' . CONFIG_SITE_NAME . ':');
     $mail->addLine(URL::toEmailVerification($mailVerificationToken));
     $mail->addLine('');
     $mail->addLine('If you did not sign up on ' . CONFIG_SITE_NAME . ' and enter your email address there, please just ignore this email and accept our excuses.');
     $mail->addLine('');
     $mail->addLine('Regards');
     $mail->addLine(CONFIG_SITE_NAME);
     $mail->addLine($mailDomain);
     $mail->send();
 }
开发者ID:jeckel420,项目名称:Localize,代码行数:18,代码来源:Authentication.php

示例5: getMissingInfo

        $status[addslashes($name)] = $value;
    }
}
// Ensure that email and rationale were provided
if ($email == '' || !Email::isValidEmail($email) || $rationale == '' || !isUTF8($rationale) || mb_strlen($rationale) > 125) {
    getMissingInfo($email, $rationale, $status);
} else {
    if ($_SERVER['PATH_INFO'] == '/confirm') {
        updateDB($email, $rationale, $status);
        outputConfirmed();
    } else {
        $body = getMailConfirmRequest($email, $rationale, $status);
        $sig = "HTML5 Status Updates\nhttp://www.whatwg.org/html5";
        $mail = new Email();
        $mail->setSubject("HTML5 Status Update");
        $mail->addRecipient('To', 'whatwg@lachy.id.au', 'Lachlan Hunt');
        $mail->setFrom("whatwg@whatwg.org", "WHATWG");
        $mail->setSignature($sig);
        $mail->setText($body);
        $mail->send();
        outputConfirmation($body, $sig);
    }
}
function getMissingInfo($email, $rationale, $status)
{
    ?>
	<title>Update Status Error</title>
    <p>You must provide a valid email address and rationale that is &le; 125 characters.</p>
	<form method="post" action="">
		<p><label for="email">Email: <input type="email" name="email" id="email" value="<?php 
    echo htmlspecialchars($email);
开发者ID:CaseyLeask,项目名称:developers.whatwg.org,代码行数:31,代码来源:update-markers.php

示例6: email

function email($to, $subject, $message, $headers = null, $params = null)
{
    // Basic validation for to address(es)
    if (!strpos($to, "@")) {
        return false;
    }
    // Create new instance of email class
    $email = new Email();
    // Generate recipient details
    $recipients = explode(",", $to);
    // Proccess multiple addresses
    for ($i = 0; $i < count($recipients); $i++) {
        // Check for name and email combination and add apropriately
        if (strpos($recipients[$i], '<')) {
            $recipient = explode("<", $recipients[$i], 2);
            $email->addRecipient(trim(str_replace('"', '', $recipient[0])), trim(str_replace('>', '', @$recipient[1])));
        } else {
            $email->addRecipient(trim($recipients[$i]));
        }
    }
    // Set subject
    $email->setSubject($subject);
    // Generate Headers
    $headers = explode("\r\n", $headers);
    for ($i = 0; $i < count($headers); $i++) {
        $email->addHeader($headers[$i]);
    }
    // Set message content
    $email->setMessage($message);
    // Check for specified sender
    if (strpos($params, "-f") !== false) {
        $sender = explode('-f', $params);
        $sender = explode(' ', @$sender[1]);
        $sender = trim($sender[0]);
        $email->setAnnounceEmail($sender);
    }
    // Send message
    return $email->send();
}
开发者ID:msabino,项目名称:beth-maria,代码行数:39,代码来源:email.php

示例7: AND

              WHERE rol_id      = ' . $group[0] . '
                AND (  cat_org_id  = ' . $gCurrentOrganization->getValue('org_id') . '
                    OR cat_org_id IS NULL )
                AND usr_valid   = 1 ' . $sqlConditions;
     // Wenn der User eingeloggt ist, wird die UserID im Statement ausgeschlossen,
     // damit er die Mail nicht an sich selber schickt.
     if ($gValidLogin) {
         $sql = $sql . ' AND usr_id <> ' . $gCurrentUser->getValue('usr_id');
     }
     $statement = $gDb->query($sql);
     if ($statement->rowCount() > 0) {
         // normaly we need no To-address and set "undisclosed recipients", but if
         // that won't work than the From-address will be set
         if ($gPreferences['mail_sender_into_to'] == 1) {
             // always fill recipient if preference is set to prevent problems with provider
             $email->addRecipient($postFrom, $postName);
         }
         // all role members will be attached as BCC
         while ($row = $statement->fetchObject()) {
             if (strValidCharacters($row->email, 'email')) {
                 $receiver[] = array($row->email, $row->first_name . ' ' . $row->last_name);
             }
         }
     }
 } else {
     // create user object
     $user = new User($gDb, $gProfileFields, $value);
     // only send email to user if current user is allowed to view this user and he has a valid email address
     if ($gCurrentUser->hasRightViewProfile($user) && strValidCharacters($user->getValue('EMAIL'), 'email')) {
         $receiver[] = array($user->getValue('EMAIL'), $user->getValue('FIRST_NAME') . ' ' . $user->getValue('LAST_NAME'));
     }
开发者ID:sxwid,项目名称:admidio3.1_scoutversion,代码行数:31,代码来源:messages_send.php

示例8: sendEcard

 /**
  * Diese Funktion ruft die Mail Klasse auf und uebergibt ihr die zu sendenden Daten
  * @param $senderName
  * @param $senderEmail
  * @param $ecardHtmlData   geparste Daten vom Template
  * @param $recipientName   der Name des Empfaengers
  * @param $recipientEmail  die Email des Empfaengers
  * @param $photoServerPath der Pfad wo die Bilder in der Grußkarte am Server liegen
  */
 public function sendEcard($senderName, $senderEmail, $ecardHtmlData, $recipientName, $recipientEmail, $photoServerPath)
 {
     global $gPreferences;
     $img_photo_path = '';
     $returnCode = true;
     $email = new Email();
     $email->setSender($senderEmail, $senderName);
     $email->setSubject($this->newMessageReceivedString);
     $email->addRecipient($recipientEmail, $recipientName);
     // alle Bilder werden aus dem Template herausgeholt, damit diese als Anhang verschickt werden koennen
     if (preg_match_all("/(<img.*src=\")(.*)(\".*>)/Uim", $ecardHtmlData, $matchArray)) {
         //$matchArray[0] = $this->deleteDoubleEntries($matchArray[0]);
         //$matchArray[2] = $this->deleteDoubleEntries($matchArray[2]);
         $matchArray[0] = array_unique($matchArray[0]);
         $matchArray[2] = array_unique($matchArray[2]);
         for ($i = 0; $i < count($matchArray[0]); ++$i) {
             // anstelle der URL muss nun noch der Server-Pfad gesetzt werden
             $img_server_path = str_replace(THEME_PATH, THEME_SERVER_PATH, $matchArray[2][$i]);
             $img_server_path = str_replace($GLOBALS['g_root_path'], SERVER_PATH, $img_server_path);
             // wird das Bild aus photo_show.php generiert, dann den uebergebenen Pfad zum Bild einsetzen
             if (strpos($img_server_path, 'photo_show.php') !== false) {
                 $img_server_path = $photoServerPath;
             }
             // Bildnamen und Typ ermitteln
             $img_name = substr(strrchr($img_server_path, '/'), 1);
             $img_type = substr(strrchr($img_name, '.'), 1);
             // das zu versendende eigentliche Bild, muss noch auf das entsprechende Format angepasst werden
             if (strpos($matchArray[2][$i], 'photo_show.php') !== false) {
                 $img_name = 'picture.' . $img_type;
                 $img_name_intern = substr(md5(uniqid($img_name . time())), 0, 8) . '.' . $img_type;
                 $img_server_path = SERVER_PATH . '/adm_my_files/photos/' . $img_name_intern;
                 $img_photo_path = $img_server_path;
                 $image_sized = new Image($photoServerPath);
                 $image_sized->scale($gPreferences['ecard_card_picture_width'], $gPreferences['ecard_card_picture_height']);
                 $image_sized->copyToFile(null, $img_server_path);
             }
             // Bild als Anhang an die Mail haengen
             if ($img_name !== 'none.jpg' && $img_name !== '') {
                 $uid = md5(uniqid($img_name . time()));
                 try {
                     $email->AddEmbeddedImage($img_server_path, $uid, $img_name, $encoding = 'base64', 'image/' . $img_type);
                 } catch (phpmailerException $e) {
                     $returnCode = $e->errorMessage();
                 }
                 $ecardHtmlData = str_replace($matchArray[2][$i], 'cid:' . $uid, $ecardHtmlData);
             }
         }
     }
     $email->setText($ecardHtmlData);
     $email->sendDataAsHtml();
     if ($returnCode == true) {
         $returnCode = $email->sendEmail();
     }
     // nun noch das von der Groesse angepasste Bild loeschen
     unlink($img_photo_path);
     return $returnCode;
 }
开发者ID:sistlind,项目名称:admidio,代码行数:66,代码来源:ecard_function.php

示例9: FormFieldText

$group2 = false;
$group3 = false;
$group4 = false;
$group5 = false;
/* Step 5: Add any custom fields here */
foreach ($config['fields'] as $field => $field_opts) {
    $fh->addField(new FormFieldText($field, \Arr::get($field_opts, 'required', false)));
}
/* Correct Field order */
$fh->fields = array_reverse($fh->fields);
/* Leave this line as is */
require '/var/www/shared/formincludes/signupFormFooter.php';
$confirmation = \Arr::get($config, 'confirmationEmail', null);
if ($fh->showSuccessText && $confirmation) {
    $enquiryEmail = new Email();
    $enquiryEmail->addRecipient($site_email);
    if (isset($config['recipients']) && $config['recipients']) {
        foreach ($config['recipients'] as $recipient) {
            $enquiryEmail->addRecipient($recipient);
        }
    }
    $enquiryEmail->setSubject('Booking reservation ' . $fh->fields['date']->value . ", " . $fh->fields['forename']->value . " " . $fh->fields['surname']->value);
    $enquiryEmail->setFromEmail($site_email);
    $enquiryEmail->setReplyTo($fh->fields['email']->value);
    $enquiryEmail->setFromName($sitename);
    $html = file_get_contents(DOCROOT . 'mailers/' . $confirmation . '.html');
    $html = str_replace("[!sitename]", $sitename, $html);
    $html = str_replace("[!facebook]", $social['facebook'], $html);
    $html = str_replace("[!submitDate]", date('j/n/Y'), $html);
    $html = str_replace("[!submitTime]", date('H:i'), $html);
    $html = str_replace("[!twitter]", $social['twitter'], $html);
开发者ID:propcom,项目名称:R7-sections,代码行数:31,代码来源:form.php

示例10: sendNotificationToWatchers

 public static function sendNotificationToWatchers($repositoryID, $eventID, $repositoryName)
 {
     $watchers = Database::getWatchers($repositoryID, $eventID);
     $recipients = array();
     $recipientIDs = array();
     foreach ($watchers as $watcher) {
         if ($watcher['email'] != '') {
             // if user has set an email address
             if ($watcher['email_lastVerificationAttempt'] == 0) {
                 // if email address has been verified
                 if (Authentication::mayReceiveNotificationsAgain($watcher['lastNotification'])) {
                     // only one notification per 24 hours
                     $recipients[] = $watcher['email'];
                     $recipientIDs[] = $watcher['userID'];
                 }
             }
         }
     }
     if (count($recipients) > 0) {
         // if there are users who must be notified
         $mailDomain = parse_url(CONFIG_ROOT_URL, PHP_URL_HOST);
         switch ($eventID) {
             case self::WATCH_EVENT_UPDATED_PHRASES:
                 $mailSubject = 'Localize: Updated phrases for ' . $repositoryName;
                 $mailIntroduction = 'There has been an update to the phrases of \'' . $repositoryName . '\' on ' . CONFIG_SITE_NAME . ':';
                 break;
             case self::WATCH_EVENT_NEW_TRANSLATIONS:
                 $mailSubject = 'Localize: New translations for ' . $repositoryName;
                 $mailIntroduction = 'New translations have been submitted to \'' . $repositoryName . '\' on ' . CONFIG_SITE_NAME . ':';
                 break;
             default:
                 throw new Exception('Unknown event ID: ' . $eventID);
         }
         $mail = new Email(CONFIG_SITE_EMAIL, CONFIG_SITE_NAME, $mailSubject);
         foreach ($recipients as $recipient) {
             $mail->addRecipient($recipient, true);
         }
         $mail->addLine('Hello,');
         $mail->addLine('');
         $mail->addLine($mailIntroduction);
         $mail->addLine(URL::toProjectShort($repositoryID));
         $mail->addLine('');
         $mail->addLine('You are receiving this email because you have added \'' . $repositoryName . '\' to your personal watch list.');
         $mail->addLine('');
         $mail->addLine('Regards');
         $mail->addLine(CONFIG_SITE_NAME);
         $mail->addLine($mailDomain);
         Database::setWatchersLastNotification($recipientIDs, time());
         $mail->send();
     }
 }
开发者ID:jeckel420,项目名称:Localize,代码行数:51,代码来源:Repository.php

示例11: complete

 /**
  * Complete Order
  *
  * Set the status to "Pending" and the data completed to now, then update DB
  */
 public function complete()
 {
     // Set status to pending and give a timestamp
     $this->setStatus("Pending");
     $this->setDateCompleted(DBConnection::format_datetime(time()));
     // Update the database record
     update_OrderDBO($this);
     // Notification e-mail
     $body = $this->replaceTokens($conf['order']['notification_email']);
     $notifyEmail = new Email();
     $notifyEmail->addRecipient($conf['company']['notification_email']);
     $notifyEmail->setFrom($conf['company']['email'], "SolidState");
     $notifyEmail->setSubject($conf['order']['notification_subject']);
     $notifyEmail->setBody($body);
     if (!$notifyEmail->send()) {
         log_error("OrderDBO::complete()", "Failed to send notification e-mail.");
     }
     // Confirmation e-mail
     $body = $this->replaceTokens($conf['order']['confirmation_email']);
     $confirmEmail = new Email();
     $confirmEmail->addRecipient($this->getContactEmail());
     $confirmEmail->setFrom($conf['company']['email'], $conf['company']['name']);
     $confirmEmail->setSubject($conf['order']['confirmation_subject']);
     $confirmEmail->setBody($body);
     if (!$confirmEmail->send()) {
         log_error("OrderDBO::complete()", "Failed to send confirmation e-mail.");
     }
 }
开发者ID:carriercomm,项目名称:NeoBill,代码行数:33,代码来源:OrderDBO.class.php

示例12: Email

 /**
  * Send Invoice Email
  *
  * Email the invoice and return to the view_invoice page
  */
 function send_invoice()
 {
     // Construct an Email
     $email = new Email();
     $email->setFrom($this->conf['company']['email'], $this->conf['company']['name']);
     $email->addRecipient($this->post['email']);
     $email->setSubject($this->post['subject']);
     $email->setBody($this->post['invoice']);
     // Send the email
     if (!$email->send()) {
         // Error delivering invoice
         throw new SWUserException("[INVOICE_EMAIL_FAILED]");
     }
     // Return to view_invoice with a sucess message
     $this->setMessage(array("type" => "[INVOICE_SENT]"));
     $this->gotoPage("billing_view_invoice", null, "invoice=" . $this->get['invoice']->getID());
 }
开发者ID:carriercomm,项目名称:NeoBill,代码行数:22,代码来源:EmailInvoicePage.class.php


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