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


PHP Message::setBody方法代码示例

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


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

示例1: testSetBody

 /**
  * @covers ICANS\Component\IcansLoggingComponent\Transport\Message::setBody
  * @depends testGetRawData
  */
 public function testSetBody()
 {
     $body = array('Body Item 1', 'Body Item 2');
     $this->object->setBody($body);
     $actual = $this->object->getRawData();
     $this->assertArrayHasKey('event_body', $actual);
     $this->assertSame($actual['event_body'], $body);
 }
开发者ID:xietongling,项目名称:IcansLoggingComponent,代码行数:12,代码来源:MessageTest.php

示例2: testNotificationException

 /**
  * @dataProvider notificationProvider
  * @expectedException \Apple\ApnPush\Notification\SendException
  */
 public function testNotificationException($response, $statusCode)
 {
     $notification = $this->createNotification($response);
     $message = new Message();
     $message->setDeviceToken(str_repeat('af', 32));
     $message->setBody('foo');
     try {
         $notification->send($message);
     } catch (SendException $exception) {
         $this->assertEquals($statusCode, $exception->getStatusCode());
         throw $exception;
     }
 }
开发者ID:sgmendez,项目名称:AppleApnPush,代码行数:17,代码来源:SendExceptionTest.php

示例3: testSettersAndGetters

 /**
  * Tests the setters and getters.
  */
 public function testSettersAndGetters()
 {
     // create a message with minimum constructor args
     $message = new Message(Message::NORMAL);
     // Set remainder via setters
     $message->setHeader((object) array('testProp' => 'testval'));
     $message->setBody(simplexml_load_string('<testMessage testAtt="Hello" testAtt2="world"/>'));
     $message->setPriority(Message::PRIORITY_LOW);
     // test assertions
     $this->assertTrue($message instanceof Message, "Expecting \$message is Message");
     $this->assertTrue($message->getType() == Message::NORMAL, "Expecting \$message->getType() == Message::NORMAL");
     $this->assertTrue($message->getHeader()->testProp == 'testval', "Expecting \$message->getHeader()->testProp == 'testval'");
     $this->assertTrue($message->getBody()->attributes()->testAtt == 'Hello', "Expecting \$message->getBody()->attributes()->testAtt == 'Hello'");
     $this->assertTrue($message->getPriority() == Message::PRIORITY_LOW, "Expecting \$message->getPriority() == Message::PRIORITY_LOW");
 }
开发者ID:pkdevboxy,项目名称:puremvc-php-util-pipes,代码行数:18,代码来源:MessageTest.php

示例4: setBody

 /**
  * set the message body (either set to a stream resource or a string)
  * @param  mixed  $body the body to use
  * @return self
  */
 public function setBody($body)
 {
     $this->cachePost = null;
     return parent::setBody($body);
 }
开发者ID:vakata,项目名称:http,代码行数:10,代码来源:Request.php

示例5: notify

 public function notify($title)
 {
     global $redcap_version;
     $dark = "#800000";
     //#1a74ba  1a74ba
     $light = "#FFE1E1";
     //#ebf6f3
     $border = "#800000";
     //FF0000";	//#a6d1ed	#3182b9
     // Run notification
     $url = APP_PATH_WEBROOT_FULL . "redcap_v{$redcap_version}/" . "DataEntry/index.php?pid={$this->project_id}&page={$this->instrument}&id={$this->record}&event_id={$this->event_id}";
     // Message (email html painfully copied from box.net notification email)
     $msg = RCView::table(array('cellpadding' => '0', 'cellspacing' => '0', 'border' => '0', 'style' => 'border:1px solid #bbb; font:normal 12px Arial;color:#666'), RCView::tr(array(), RCView::td(array('style' => 'padding:13px'), RCView::table(array('style' => 'font:normal 15px Arial'), RCView::tr(array(), RCView::td(array('style' => 'font-size:18px;color:#000;border-bottom:1px solid #bbb'), RCView::span(array('style' => 'color:black'), RCVieW::a(array('style' => 'color:black'), 'REDCap AutoNotification Alert')) . RCView::br())) . RCView::tr(array(), RCView::td(array('style' => 'padding:10px 0'), RCView::table(array('style' => 'font:normal 12px Arial;color:#666'), RCView::tr(array(), RCView::td(array('style' => 'text-align:right'), "Title") . RCView::td(array('style' => 'padding-left:10px;color:#000'), RCView::span(array('style' => 'color:black'), RCView::a(array('style' => 'color:black'), "<b>{$title}</b>")))) . RCView::tr(array(), RCView::td(array('style' => 'text-align:right'), "Project") . RCView::td(array('style' => 'padding-left:10px;color:#000'), RCView::span(array('style' => 'color:black'), RCView::a(array('style' => 'color:black'), REDCap::getProjectTitle())))) . ($this->redcap_event_name ? RCView::tr(array(), RCView::td(array('style' => 'text-align:right'), "Event") . RCView::td(array('style' => 'padding-left:10px;color:#000'), RCView::span(array('style' => 'color:black'), RCView::a(array('style' => 'color:black'), "{$this->redcap_event_name}")))) : '') . RCView::tr(array(), RCView::td(array('style' => 'text-align:right'), "Instrument") . RCView::td(array('style' => 'padding-left:10px;color:#000'), RCView::span(array('style' => 'color:black'), RCView::a(array('style' => 'color:black'), $this->instrument)))) . RCView::tr(array(), RCView::td(array('style' => 'text-align:right'), "Record") . RCView::td(array('style' => 'padding-left:10px;color:#000'), RCView::span(array('style' => 'color:black'), RCView::a(array('style' => 'color:black'), $this->record)))) . RCView::tr(array(), RCView::td(array('style' => 'text-align:right'), "Date/Time") . RCView::td(array('style' => 'padding-left:10px;color:#000'), RCView::span(array('style' => 'color:black'), RCView::a(array('style' => 'color:black'), date('Y-m-d H:i:s'))))) . RCView::tr(array(), RCView::td(array('style' => 'text-align:right'), "Message") . RCView::td(array('style' => 'padding-left:10px;color:#000'), RCView::span(array('style' => 'color:black'), RCView::a(array('style' => 'color:black'), $this->config['message']))))))) . RCView::tr(array(), RCView::td(array('style' => "border:1px solid {$border};background-color:{$light};padding:20px"), RCView::table(array('style' => 'font:normal 12px Arial', 'cellpadding' => '0', 'cellspacing' => '0'), RCView::tr(array('style' => 'vertical-align:middle'), RCView::td(array(), RCView::table(array('cellpadding' => '0', 'cellspacing' => '0'), RCView::tr(array(), RCView::td(array('style' => "border:1px solid #600000;background-color:{$dark};padding:8px;font:bold 12px Arial"), RCView::a(array('class' => 'hide', 'style' => 'color:#fff;white-space:nowrap;text-decoration:none', 'href' => $url), "View Record"))))) . RCView::td(array('style' => 'padding-left:15px'), "To view this record, visit this link:" . RCView::br() . RCView::a(array('style' => "color:{$dark}", 'href' => $url), $url))))))))));
     $msg = "<HTML><head></head><body>" . $msg . "</body></html>";
     // Determine number of emails to send
     // Prepare message
     $email = new Message();
     $email->setTo($this->config['to']);
     $email->setFrom($this->config['from']);
     $email->setSubject($this->config['subject']);
     $email->setBody($msg);
     // Send Email
     if (!$email->send()) {
         error_log('Error sending mail: ' . $email->getSendError() . ' with ' . json_encode($email));
         exit;
     }
     //		error_log ('Email sent');
     // Add Log Entry
     $data_values = "title,{$title}\nrecord,{$this->record}\nevent,{$this->redcap_event_name}";
     REDCap::logEvent('AutoNotify Alert', $data_values);
 }
开发者ID:mypandos,项目名称:REDCap-AutoNotify,代码行数:31,代码来源:common.php

示例6: sign

 /**
  * Sign a message (but don't encrypt)
  *
  * @param Message $message
  * @return Message
  * @throws \Exception
  */
 public function sign(Message $message) : Message
 {
     if (!$this->serverKeyFingerprint) {
         throw new \Exception('No signing key provided');
     }
     $gnupg = new \Crypt_GPG($this->options);
     $gnupg->addSignKey($this->serverKeyFingerprint);
     $message->setBody($gnupg->sign($message->getBodyText(), \Crypt_GPG::SIGN_MODE_CLEAR, true));
     return $message;
 }
开发者ID:paragonie,项目名称:gpg-mailer,代码行数:17,代码来源:GPGMailer.php

示例7: testSetBody

 /**
  * Tests Message->setBody()
  */
 public function testSetBody()
 {
     $this->Message->setBody('body');
     $this->assertEquals('body', $this->Message->body);
 }
开发者ID:ahmedadham88,项目名称:enhanced-social-network,代码行数:8,代码来源:MessageTest.php

示例8: sq_send_mail

/**
 * Send a simple mail message using SquirrelMail's API.
 *
 * Until SquirrelMail is sufficiently redesigned, this
 * function is a stand-in for a simple mail delivery
 * call.  Currently, it only sends plaintext messages
 * (unless the caller uses the $message parameter).
 *
 * @param string $to      The destination recipient.
 * @param string $subject The message subject.
 * @param string $body    The message body.
 * @param string $from    The sender.
 * @param string $cc      The destination carbon-copy recipient.
 *                        (OPTIONAL; default no Cc:)
 * @param string $bcc     The destination blind carbon-copy recipient.
 *                        (OPTIONAL; default no Bcc:)
 * @param object $message If the caller wants to construct a more
 *                        complicated message themselves and pass
 *                        it here, this function will take care
 *                        of the rest - handing it over to SMTP
 *                        or Sendmail.  If this parameter is non-
 *                        empty, all other parameters are ignored.
 *                        (OPTIONAL: default is empty)
 *
 * @return array A two-element array, the first element being a
 *               boolean value indicating if the message was successfully
 *               sent or not, and the second element being the message's
 *               assigned Message-ID, if available (only available as of
 *               SquirrelMail 1.4.14 and 1.5.2)
 *
 */
function sq_send_mail($to, $subject, $body, $from, $cc = '', $bcc = '', $message = '')
{
    require_once SM_PATH . 'functions/mime.php';
    require_once SM_PATH . 'class/mime.class.php';
    if (empty($message)) {
        $message = new Message();
        $header = new Rfc822Header();
        $message->setBody($body);
        $content_type = new ContentType('text/plain');
        global $special_encoding, $default_charset;
        if ($special_encoding) {
            $header->encoding = $special_encoding;
        } else {
            $header->encoding = '8bit';
        }
        if ($default_charset) {
            $content_type->properties['charset'] = $default_charset;
        }
        $header->content_type = $content_type;
        $header->parseField('To', $to);
        $header->parseField('Cc', $cc);
        $header->parseField('Bcc', $bcc);
        $header->parseField('From', $from);
        $header->parseField('Subject', $subject);
        $message->rfc822_header = $header;
    }
    //sm_print_r($message);exit;
    global $useSendmail;
    // ripped from src/compose.php - based on both 1.5.2 and 1.4.14
    //
    if (!$useSendmail) {
        require_once SM_PATH . 'class/deliver/Deliver_SMTP.class.php';
        $deliver = new Deliver_SMTP();
        global $smtpServerAddress, $smtpPort, $pop_before_smtp, $domain, $pop_before_smtp_host;
        $authPop = isset($pop_before_smtp) && $pop_before_smtp ? true : false;
        if (empty($pop_before_smtp_host)) {
            $pop_before_smtp_host = $smtpServerAddress;
        }
        $user = '';
        $pass = '';
        get_smtp_user($user, $pass);
        $stream = $deliver->initStream($message, $domain, 0, $smtpServerAddress, $smtpPort, $user, $pass, $authPop, $pop_before_smtp_host);
    } else {
        require_once SM_PATH . 'class/deliver/Deliver_SendMail.class.php';
        global $sendmail_path, $sendmail_args;
        // Check for outdated configuration
        if (!isset($sendmail_args)) {
            if ($sendmail_path == '/var/qmail/bin/qmail-inject') {
                $sendmail_args = '';
            } else {
                $sendmail_args = '-i -t';
            }
        }
        $deliver = new Deliver_SendMail(array('sendmail_args' => $sendmail_args));
        $stream = $deliver->initStream($message, $sendmail_path);
    }
    $success = false;
    $message_id = '';
    if ($stream) {
        $deliver->mail($message, $stream);
        if (!empty($message->rfc822_header->message_id)) {
            $message_id = $message->rfc822_header->message_id;
        }
        $success = $deliver->finalizeStream($stream);
    }
    return array($success, $message_id);
}
开发者ID:teammember8,项目名称:roundcube,代码行数:98,代码来源:compose.php

示例9: serialize

}
$total_messages = imap_num_msg($mbox);
$charset = 'UTF-8';
$structure = imap_fetchstructure($mbox, $msg_number);
foreach ($structure->parameters as $param) {
    if ($param->attribute == 'charset') {
        $charset = $param->value;
        break;
    }
}
$header = imap_headerinfo($mbox, $msg_number);
$message->setFrom($header->fromaddress);
$message->setTo($header->toaddress);
$message->setCc($header->ccaddress);
$message->setSubject($header->subject);
$message->setBody(imap_fetchbody($mbox, $msg_number, '1'));
// '1' is the text/plain version of the body in a multipart message
$message->setDate($header->date);
$_SESSION['currentMessage'] = serialize($message);
if ($msg_number > 1) {
    $prev_message = imap_uid($mbox, $msg_number - 1);
} else {
    $prev_message = null;
}
if ($msg_number < $total_messages) {
    $next_message = imap_uid($mbox, $msg_number + 1);
} else {
    $next_message = null;
}
imap_close($mbox);
header("Content-Type: application/x-blueprint+xml");
开发者ID:palako,项目名称:mobilewebmail,代码行数:31,代码来源:viewmessage.php

示例10: SendMDN

function SendMDN($mailbox, $passed_id, $message, $imapConnection)
{
    global $squirrelmail_language, $default_charset, $default_move_to_sent, $languages, $useSendmail, $domain, $sent_folder, $username, $data_dir;
    sqgetGlobalVar('SERVER_NAME', $SERVER_NAME, SQ_SERVER);
    $header = $message->rfc822_header;
    $rfc822_header = new Rfc822Header();
    $content_type = new ContentType('multipart/report');
    $content_type->properties['report-type'] = 'disposition-notification';
    set_my_charset();
    if ($default_charset) {
        $content_type->properties['charset'] = $default_charset;
    }
    $rfc822_header->content_type = $content_type;
    $rfc822_header->to[] = $header->dnt;
    $rfc822_header->subject = _("Read:") . ' ' . decodeHeader($header->subject, true, false);
    $idents = get_identities();
    $needles = array();
    if ($header->to) {
        foreach ($header->to as $message_to) {
            $needles[] = $message_to->mailbox . '@' . $message_to->host;
        }
    }
    $identity = find_identity($needles);
    $from_addr = build_from_header($identity);
    $reply_to = isset($idents[$identity]['reply_to']) ? $idents[$identity]['reply_to'] : '';
    // FIXME: this must actually be the envelope address of the orginal message,
    // but do we have that information? For now the first identity is our best guess.
    $final_recipient = $idents[0]['email_address'];
    $rfc822_header->from = $rfc822_header->parseAddress($from_addr, true);
    if ($reply_to) {
        $rfc822_header->reply_to = $rfc822_header->parseAddress($reply_to, true);
    }
    // part 1 (RFC2298)
    $senton = getLongDateString($header->date, $header->date_unparsed);
    $to_array = $header->to;
    $to = '';
    foreach ($to_array as $line) {
        $to .= ' ' . $line->getAddress();
    }
    $now = getLongDateString(time());
    set_my_charset();
    $body = _("Your message") . "\r\n\r\n" . "\t" . _("To") . ': ' . decodeHeader($to, false, false) . "\r\n" . "\t" . _("Subject") . ': ' . decodeHeader($header->subject, false, false) . "\r\n" . "\t" . _("Sent") . ': ' . $senton . "\r\n" . "\r\n" . sprintf(_("Was displayed on %s"), $now);
    $special_encoding = '';
    if (isset($languages[$squirrelmail_language]['XTRA_CODE']) && function_exists($languages[$squirrelmail_language]['XTRA_CODE'] . '_encode')) {
        $body = call_user_func($languages[$squirrelmail_language]['XTRA_CODE'] . '_encode', $body);
        if (strtolower($default_charset) == 'iso-2022-jp') {
            if (mb_detect_encoding($body) == 'ASCII') {
                $special_encoding = '8bit';
            } else {
                $body = mb_convert_encoding($body, 'JIS');
                $special_encoding = '7bit';
            }
        }
    } elseif (sq_is8bit($body)) {
        $special_encoding = '8bit';
    }
    $part1 = new Message();
    $part1->setBody($body);
    $mime_header = new MessageHeader();
    $mime_header->type0 = 'text';
    $mime_header->type1 = 'plain';
    if ($special_encoding) {
        $mime_header->encoding = $special_encoding;
    } else {
        $mime_header->encoding = '7bit';
    }
    if ($default_charset) {
        $mime_header->parameters['charset'] = $default_charset;
    }
    $part1->mime_header = $mime_header;
    // part2  (RFC2298)
    $original_recipient = $to;
    $original_message_id = $header->message_id;
    $report = "Reporting-UA : {$SERVER_NAME} ; SquirrelMail (version " . SM_VERSION . ") \r\n";
    if ($original_recipient != '') {
        $report .= "Original-Recipient : {$original_recipient}\r\n";
    }
    $report .= "Final-Recipient: rfc822; {$final_recipient}\r\n" . "Original-Message-ID : {$original_message_id}\r\n" . "Disposition: manual-action/MDN-sent-manually; displayed\r\n";
    $part2 = new Message();
    $part2->setBody($report);
    $mime_header = new MessageHeader();
    $mime_header->type0 = 'message';
    $mime_header->type1 = 'disposition-notification';
    $mime_header->encoding = '7bit';
    $part2->mime_header = $mime_header;
    $composeMessage = new Message();
    $composeMessage->rfc822_header = $rfc822_header;
    $composeMessage->addEntity($part1);
    $composeMessage->addEntity($part2);
    if ($useSendmail) {
        require_once SM_PATH . 'class/deliver/Deliver_SendMail.class.php';
        global $sendmail_path, $sendmail_args;
        // Check for outdated configuration
        if (!isset($sendmail_args)) {
            if ($sendmail_path == '/var/qmail/bin/qmail-inject') {
                $sendmail_args = '';
            } else {
                $sendmail_args = '-i -t';
            }
        }
//.........这里部分代码省略.........
开发者ID:teammember8,项目名称:roundcube,代码行数:101,代码来源:read_body.php

示例11: getMessages

 public function getMessages($userId, $msgCollId, $fields, $msgIds, $options)
 {
     // TODO: Supports fields and options. Currently deleted messages couldn't be retrieved.
     $this->checkDb();
     $userId = intval($userId);
     $fromQuery = " (messages.from = {$userId} and messages.from_deleted = 'no')";
     $toQuery = " (messages.to = {$userId} and messages.to_deleted = 'no')";
     $basicQuery = '';
     $groupTable = '';
     if ($msgCollId == '@inbox') {
         $basicQuery = $toQuery;
     } else {
         if ($msgCollId == '@outbox') {
             $basicQuery = $fromQuery;
         } else {
             if ($msgCollId == '@all') {
                 $basicQuery = " ( " . $fromQuery . " or " . $toQuery . ")";
             } else {
                 $msgCollId = intval($msgCollId);
                 $groupTable = ', message_groups';
                 $basicQuery = " messages.id = message_groups.message_id and " . " ( " . $fromQuery . " or " . $toQuery . ")" . " and message_groups.message_collection_id = {$msgCollId}";
             }
         }
     }
     $messageIdQuery = '';
     if (isset($msgIds) && is_array($msgIds) && count($msgIds) > 0) {
         $msgIds = array_map('intval', $msgIds);
         $messageIdQuery = " and messages.id in (" . implode(',', $msgIds) . ")";
     }
     $countQuery = "select count(*) from messages {$groupTable} where {$basicQuery} {$messageIdQuery}";
     $res = mysqli_query($this->db, $countQuery);
     if ($res !== false) {
         list($totalResults) = mysqli_fetch_row($res);
     } else {
         $totalResults = '0';
     }
     $startIndex = $options->getStartIndex();
     $count = $options->getCount();
     $messages = array();
     $messages['totalResults'] = $totalResults;
     $messages['startIndex'] = $startIndex;
     $messages['count'] = $count;
     $query = "select messages.from as `from`,\n                     messages.to as `to`,\n                     messages.id as id,\n                     messages.title as title,\n                     messages.body as body,\n                     messages.updated as updated,\n                     messages.collection_ids as collection_ids,\n                     messages.recipients as recipients\n                from messages {$groupTable}\n                where {$basicQuery} {$messageIdQuery}\n                order by messages.created desc\n                limit {$startIndex}, {$count};";
     $res = mysqli_query($this->db, $query);
     if ($res) {
         if (@mysqli_num_rows($res)) {
             while ($row = @mysqli_fetch_array($res, MYSQLI_ASSOC)) {
                 $message = new Message($row['id'], $row['title']);
                 $message->setBody($row['body']);
                 $message->setUpdated($row['updated']);
                 $message->setRecipients(json_decode($row['recipients']));
                 if ($row['collection_ids']) {
                     $message->setCollectionIds(json_decode($row['collection_ids']));
                 }
                 $messages[] = $message;
             }
         } else {
             if ($messageIdQuery) {
                 throw new SocialSpiException("Message not found", ResponseError::$NOT_FOUND);
             }
         }
         return $messages;
     }
 }
开发者ID:vuxuandung,项目名称:Partuza-bundle,代码行数:64,代码来源:PartuzaDbFetcher.php

示例12: send

 /**
  * send:
  *
  * @param array|string $pmTo
  *        	- Who will receve the message, array('email', 'name') or
  *        	'email'
  * @param string $psSubject
  *        	messagem subject
  * @param string $psBodyText
  *        	- message in plan text format
  * @param string $psBodyHtml
  *        	- message in html format
  * @param array|string $paFrom
  *        	- Who send the message, array('email', 'name') or 'email'
  *        	
  * @return Zend_Mail
  */
 public function send($pmFrom, $psSubject, $pmBody, $pmTo = null)
 {
     $lsFromEmail = null;
     $lsFromName = null;
     $lsToEmail = null;
     $lsToName = null;
     $loMail = new Message();
     $loMail->setEncoding($this->_aOptions['charset']);
     $loMail->setSender($this->_aOptions["fromEmail"], $this->_aOptions["fromName"]);
     $loMail->addReplyTo($this->_aOptions["replayToEmail"], $this->_aOptions["replayToName"]);
     $loMail->setSubject($psSubject);
     $loMail->setBody($this->setContainer($pmBody));
     if (is_array($pmTo)) {
         if (isset($pmTo[0])) {
             $lsToEmail = $pmTo[0];
         }
         if (isset($pmTo[1])) {
             $lsToName = $pmTo[1];
         }
     } elseif (is_string($pmTo)) {
         $lsToEmail = $pmTo;
     } else {
         $lsToEmail = $this->_aOptions["fromEmail"];
         $lsToName = $this->_aOptions["fromName"];
     }
     $loMail->addTo($lsToEmail, $lsToName);
     if (is_array($pmFrom)) {
         if (isset($pmFrom[0])) {
             $lsFromEmail = $pmFrom[0];
         }
         if (isset($pmFrom[1])) {
             $lsFromName = $pmFrom[1];
         }
     } elseif (is_string($pmFrom)) {
         $lsFromEmail = $pmFrom;
     } else {
         $lsFromEmail = $this->_aOptions["fromEmail"];
         $lsFromName = $this->_aOptions["fromName"];
     }
     $loMail->setFrom($lsFromEmail, $lsFromName);
     if ($this->_aOptions["transporter"] == "SMTP") {
         $loOptionsSMTP = new Transport\SmtpOptions($this->getSMTPOptions());
         $loTransport = new Transport\Smtp($loOptionsSMTP);
         $loTransport->send($loMail);
     } elseif ($this->_aOptions["transporter"] == "sendmail") {
         $loTransport = new Transport\Sendmail();
         $loTransport->send($loMail);
     }
 }
开发者ID:m3uzz,项目名称:onionfw,代码行数:66,代码来源:SendMail.php

示例13: SendMDN

function SendMDN($mailbox, $passed_id, $sender, $message, $imapConnection)
{
    global $username, $attachment_dir, $version, $attachments, $squirrelmail_language, $default_charset, $languages, $useSendmail, $domain, $sent_folder, $popuser, $data_dir, $username;
    sqgetGlobalVar('SERVER_NAME', $SERVER_NAME, SQ_SERVER);
    $header = $message->rfc822_header;
    $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
    $rfc822_header = new Rfc822Header();
    $content_type = new ContentType('multipart/report');
    $content_type->properties['report-type'] = 'disposition-notification';
    set_my_charset();
    if ($default_charset) {
        $content_type->properties['charset'] = $default_charset;
    }
    $rfc822_header->content_type = $content_type;
    $rfc822_header->to[] = $header->dnt;
    $rfc822_header->subject = _("Read:") . ' ' . encodeHeader($header->subject);
    // Patch #793504 Return Receipt Failing with <@> from Tim Craig (burny_md)
    // This merely comes from compose.php and only happens when there is no
    // email_addr specified in user's identity (which is the startup config)
    if (ereg("^([^@%/]+)[@%/](.+)\$", $username, $usernamedata)) {
        $popuser = $usernamedata[1];
        $domain = $usernamedata[2];
        unset($usernamedata);
    } else {
        $popuser = $username;
    }
    $reply_to = '';
    $ident = get_identities();
    if (!isset($identity)) {
        $identity = 0;
    }
    $full_name = $ident[$identity]['full_name'];
    $from_mail = $ident[$identity]['email_address'];
    $from_addr = '"' . $full_name . '" <' . $from_mail . '>';
    $reply_to = $ident[$identity]['reply_to'];
    if (!$from_mail) {
        $from_mail = "{$popuser}@{$domain}";
        $from_addr = $from_mail;
    }
    $rfc822_header->from = $rfc822_header->parseAddress($from_addr, true);
    if ($reply_to) {
        $rfc822_header->reply_to = $rfc822_header->parseAddress($reply_to, true);
    }
    // part 1 (RFC2298)
    $senton = getLongDateString($header->date);
    $to_array = $header->to;
    $to = '';
    foreach ($to_array as $line) {
        $to .= ' ' . $line->getAddress();
    }
    $now = getLongDateString(time());
    set_my_charset();
    $body = _("Your message") . "\r\n\r\n" . "\t" . _("To") . ': ' . decodeHeader($to, false, false) . "\r\n" . "\t" . _("Subject") . ': ' . decodeHeader($header->subject, false, false) . "\r\n" . "\t" . _("Sent") . ': ' . $senton . "\r\n" . "\r\n" . sprintf(_("Was displayed on %s"), $now);
    $special_encoding = '';
    if (isset($languages[$squirrelmail_language]['XTRA_CODE']) && function_exists($languages[$squirrelmail_language]['XTRA_CODE'] . '_encode')) {
        $body = call_user_func($languages[$squirrelmail_language]['XTRA_CODE'] . '_encode', $body);
        if (strtolower($default_charset) == 'iso-2022-jp') {
            if (mb_detect_encoding($body) == 'ASCII') {
                $special_encoding = '8bit';
            } else {
                $body = mb_convert_encoding($body, 'JIS');
                $special_encoding = '7bit';
            }
        }
    } elseif (sq_is8bit($body)) {
        $special_encoding = '8bit';
    }
    $part1 = new Message();
    $part1->setBody($body);
    $mime_header = new MessageHeader();
    $mime_header->type0 = 'text';
    $mime_header->type1 = 'plain';
    if ($special_encoding) {
        $mime_header->encoding = $special_encoding;
    } else {
        $mime_header->encoding = 'us-ascii';
    }
    if ($default_charset) {
        $mime_header->parameters['charset'] = $default_charset;
    }
    $part1->mime_header = $mime_header;
    // part2  (RFC2298)
    $original_recipient = $to;
    $original_message_id = $header->message_id;
    $report = "Reporting-UA : {$SERVER_NAME} ; SquirrelMail (version {$version}) \r\n";
    if ($original_recipient != '') {
        $report .= "Original-Recipient : {$original_recipient}\r\n";
    }
    $final_recipient = $sender;
    $report .= "Final-Recipient: rfc822; {$final_recipient}\r\n" . "Original-Message-ID : {$original_message_id}\r\n" . "Disposition: manual-action/MDN-sent-manually; displayed\r\n";
    $part2 = new Message();
    $part2->setBody($report);
    $mime_header = new MessageHeader();
    $mime_header->type0 = 'message';
    $mime_header->type1 = 'disposition-notification';
    $mime_header->encoding = 'us-ascii';
    $part2->mime_header = $mime_header;
    $composeMessage = new Message();
    $composeMessage->rfc822_header = $rfc822_header;
    $composeMessage->addEntity($part1);
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:hpt-obm-svn,代码行数:101,代码来源:read_body.php

示例14: message

 /**
  * @param string $body
  *
  * @return Message
  */
 public function message($body = '')
 {
     $message = new Message();
     $message->setParent($this);
     $message->setBody($body);
     return $message;
 }
开发者ID:platforg,项目名称:softlayer-message-queue-php,代码行数:12,代码来源:Queue.php

示例15: SendMDN

function SendMDN($mailbox, $passed_id, $sender, $message, $imapConnection)
{
    global $username, $attachment_dir, $color, $default_move_to_sent, $version, $attachments, $squirrelmail_language, $default_charset, $languages, $useSendmail, $domain, $sent_folder, $popuser, $data_dir;
    sqgetGlobalVar('SERVER_NAME', $SERVER_NAME, SQ_SERVER);
    $header = $message->rfc822_header;
    $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
    $rfc822_header = new Rfc822Header();
    $content_type = new ContentType('multipart/report');
    $content_type->properties['report-type'] = 'disposition-notification';
    set_my_charset();
    if ($default_charset) {
        $content_type->properties['charset'] = $default_charset;
    }
    $rfc822_header->content_type = $content_type;
    $rfc822_header->to[] = $header->dnt;
    $rfc822_header->subject = _("Read:") . ' ' . decodeHeader($header->subject, true, false);
    // FIXME: use identity.php from SM 1.5. Change this also in compose.php
    $reply_to = '';
    if (isset($identity) && $identity != 'default') {
        $from_mail = getPref($data_dir, $username, 'email_address' . $identity);
        $full_name = getPref($data_dir, $username, 'full_name' . $identity);
        $from_addr = '"' . $full_name . '" <' . $from_mail . '>';
        $reply_to = getPref($data_dir, $username, 'reply_to' . $identity);
    } else {
        $from_mail = getPref($data_dir, $username, 'email_address');
        $full_name = getPref($data_dir, $username, 'full_name');
        $from_addr = '"' . $full_name . '" <' . $from_mail . '>';
        $reply_to = getPref($data_dir, $username, 'reply_to');
    }
    // Patch #793504 Return Receipt Failing with <@> from Tim Craig (burny_md)
    // This merely comes from compose.php and only happens when there is no
    // email_addr specified in user's identity (which is the startup config)
    if (ereg("^([^@%/]+)[@%/](.+)\$", $username, $usernamedata)) {
        $popuser = $usernamedata[1];
        $domain = $usernamedata[2];
        unset($usernamedata);
    } else {
        $popuser = $username;
    }
    if (!$from_mail) {
        $from_mail = "{$popuser}@{$domain}";
        $from_addr = $from_mail;
    }
    $rfc822_header->from = $rfc822_header->parseAddress($from_addr, true);
    if ($reply_to) {
        $rfc822_header->reply_to = $rfc822_header->parseAddress($reply_to, true);
    }
    // part 1 (RFC2298)
    $senton = getLongDateString($header->date, $header->date_unparsed);
    $to_array = $header->to;
    $to = '';
    foreach ($to_array as $line) {
        $to .= ' ' . $line->getAddress();
    }
    $now = getLongDateString(time());
    set_my_charset();
    $body = _("Your message") . "\r\n\r\n" . "\t" . _("To") . ': ' . decodeHeader($to, false, false, true) . "\r\n" . "\t" . _("Subject") . ': ' . decodeHeader($header->subject, false, false, true) . "\r\n" . "\t" . _("Sent") . ': ' . $senton . "\r\n" . "\r\n" . sprintf(_("Was displayed on %s"), $now);
    $special_encoding = '';
    if (isset($languages[$squirrelmail_language]['XTRA_CODE']) && function_exists($languages[$squirrelmail_language]['XTRA_CODE'])) {
        $body = $languages[$squirrelmail_language]['XTRA_CODE']('encode', $body);
        if (strtolower($default_charset) == 'iso-2022-jp') {
            if (mb_detect_encoding($body) == 'ASCII') {
                $special_encoding = '8bit';
            } else {
                $body = mb_convert_encoding($body, 'JIS');
                $special_encoding = '7bit';
            }
        }
    } elseif (sq_is8bit($body)) {
        // detect 8bit symbols added by translations
        $special_encoding = '8bit';
    }
    $part1 = new Message();
    $part1->setBody($body);
    $mime_header = new MessageHeader();
    $mime_header->type0 = 'text';
    $mime_header->type1 = 'plain';
    if ($special_encoding) {
        $mime_header->encoding = $special_encoding;
    } else {
        $mime_header->encoding = '7bit';
    }
    if ($default_charset) {
        $mime_header->parameters['charset'] = $default_charset;
    }
    $part1->mime_header = $mime_header;
    // part2  (RFC2298)
    $original_recipient = $to;
    $original_message_id = $header->message_id;
    $report = "Reporting-UA : {$SERVER_NAME} ; SquirrelMail (version {$version}) \r\n";
    if ($original_recipient != '') {
        $report .= "Original-Recipient : {$original_recipient}\r\n";
    }
    $final_recipient = $sender;
    $report .= "Final-Recipient: rfc822; {$final_recipient}\r\n" . "Original-Message-ID : {$original_message_id}\r\n" . "Disposition: manual-action/MDN-sent-manually; displayed\r\n";
    $part2 = new Message();
    $part2->setBody($report);
    $mime_header = new MessageHeader();
    $mime_header->type0 = 'message';
    $mime_header->type1 = 'disposition-notification';
//.........这里部分代码省略.........
开发者ID:jprice,项目名称:EHCP,代码行数:101,代码来源:read_body.php


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