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


PHP Message::setSubject方法代码示例

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


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

示例1: followchannel

function followchannel($channelid){

	if ($_SESSION['user']->isAnon())
		return array("ok"=>false, "error"=>"you have to login");

	global $LANGALL;
	global $CONF;

	$channel = new Channel();
	if (!isset($channelid))
		return array("ok"=>false, "error"=>"no id");
	$channel->setId($channelid);
	if ($channel->getAsktofollow()){
		if ($_SESSION['user']->isAnon())
			return array("ok"=>false, "error"=>"anon cant follow");

		require_once('class/Message.php');
		$message = new Message();
		$message->setUserFrom($_SESSION['user']);
		$message->setUserTo($channel->getUser());

		$__ufid = $channel->unconfirmed_follow();
		$check=hash('sha512',"00`Θ^*' ♣  hk".chr(11)."1".$__ufid);

		if ($channel->getUser()->getLang()=='pt_br'){
			$message->setSubject($LANGALL['pt_br']['channel_asktofollow_subject']);
			eval($LANGALL['pt_br']['channel_asktofollow_msg']);
			$msg = '#'.$channel->getName().'\n<br/>'.'@'.$_SESSION['user']->getNickname().'\n<br/>'.$body;
			if (isset($_GET['msg_followchannel']))
				$msg.=$_GET['msg_followchannel'];
			$message->setMsg($msg);
		} else {
			$message->setSubject($LANGALL['en_us']['channel_asktofollow_subject']);
			eval($LANGALL['pt_br']['channel_asktofollow_msg']);
			$msg = '#'.$channel->getName().'\n<br/>'.'@'.$_SESSION['user']->getNickname().'\n<br/>'.$body;
			if (isset($_GET['msg_followchannel']))
				$msg.=$_GET['msg_followchannel'];
			$message->setMsg($msg);
		}
		$result=$message->save();
		if ($result=='ok')
			return array("ok"=>false, "error"=>"asked for permission", "msg"=>"asked for permission");
		else
			return array("ok"=>false, "error"=>"error cant send message: ".$result, "msg"=>"");
		
	} else {
		if ($channel->follow())
			return array("ok"=>true, "error"=>"");
		else
			return array("ok"=>false, "error"=>"cant follow");
	}

}
开发者ID:rczeus,项目名称:Rapid-Coffee,代码行数:53,代码来源:followchannel.php

示例2: testSetGet

 public function testSetGet()
 {
     $now = new \DateTime();
     $testCase = ['id' => 123, 'level' => 2, 'subject' => 'TEST SUBJECT', 'message' => 'TEST MESSAGE', 'source' => 'TEST_SOURCE', 'dateCreated' => $now, 'dateCreatedString' => $now->format(\DateTime::ISO8601)];
     $unit = new Message();
     $unit->setId($testCase['id']);
     $this->assertEquals($testCase['id'], $unit->getId());
     $unit->setLevel(0);
     $this->assertEquals(Message::LEVEL_DEFAULT, $unit->getLevel());
     $unit->setLevel($testCase['level']);
     $this->assertEquals($testCase['level'], $unit->getLevel());
     $unit->setSubject($testCase['subject']);
     $this->assertEquals($testCase['subject'], $unit->getSubject());
     $unit->setMessage($testCase['message']);
     $this->assertEquals($testCase['message'], $unit->getMessage());
     $unit->setSource('');
     $this->assertNull($unit->getSource());
     $unit->setSource($testCase['source']);
     $this->assertEquals($testCase['source'], $unit->getSource());
     $unit->setDateCreated(null);
     $this->assertNull($unit->getDateCreatedString());
     $unit->setDateCreated($testCase['dateCreated']);
     $this->assertEquals($testCase['dateCreated'], $unit->getDateCreated());
     $unit->setDateCreatedString($testCase['dateCreatedString']);
     $this->assertEquals($testCase['dateCreatedString'], $unit->getDateCreatedString());
     $this->assertEquals($testCase['id'], $unit->toArray()['id']);
     $this->assertTrue(is_array($unit->toArray()));
 }
开发者ID:reliv,项目名称:rcm-message,代码行数:28,代码来源:MessageTest.php

示例3: convertToMessage

 function convertToMessage($msg)
 {
     $message = new Message();
     $message->setId($msg['id']);
     $message->setDate($msg['sent_date']);
     $message->setFrom($msg['msg_from']);
     $message->setMessage($msg['message']);
     $message->setSubject($msg['subject']);
     return $message;
 }
开发者ID:ArRolin,项目名称:WP-Message-Plugin,代码行数:10,代码来源:messageService.php

示例4: add_message

function add_message()
{
	global $CONF;
	$user = $_SESSION['user'];

	if ($user->getBanned()>0){
		return array('ok'=>false, 'error'=>'banned '.$user->getBanned());
	}

	if (isset($_SESSION['message_last_flood_time'])){

		if ((time() - $_SESSION['message_last_flood_time']) < $CONF['message_time_to_wait_flood']){
			$time_to_wait = $CONF['message_time_to_wait_flood'] - (time() - $_SESSION['message_last_flood_time']);
			return array('ok'=>false, 'error'=>'flood '.$time_to_wait);
		}

	}

	$_SESSION['message_last_flood_time']=time();

	$user = $_SESSION['user'];
	$userto=new RegUser();
	if (isset($_POST['user_to_id'])) $userto->setId($_POST['user_to_id']);
	elseif (isset($_POST['user_to_email'])) $userto->setEmail($_POST['user_to_email']);
	elseif (isset($_POST['user_to_nickname'])) $userto->setNickname($_POST['user_to_nickname']);
	else return array('ok'=>false, 'error'=>'undefined user to send');

	$message = new Message();

	$message->setUserFrom($user);
	$message->setUserTo($userto);

	$subject = strip_tags($_POST['subject']);
	if (strlen(str_replace(' ', '', $subject)) < $CONF['min_msg_chars'])
		return array('ok'=>false, 'error'=>'too short subject');
	$message->setSubject($subject);

	$msg = unescape_ampersand($_POST['msg']);
	if (strlen(str_replace(' ', '', strip_tags($msg))) < $CONF['min_msg_chars'])
		return array('ok'=>false, 'error'=>'too short message');

	$msg = strip_tags($msg, $CONF['permitted_tags_msg']);
	//$msg = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]","<a target=\"_BLANK\" href=\"\\0\">\\0</a>", $msg); //detectando URLs
	$msg = text_linkify($msg);
	$msg = str_replace('&nbsp;',' ',$msg);
	$message->setMsg($msg);

	$result = $message->save();
	if ($result=='ok'){
		return array('ok'=>true, 'error'=>'');
	}
	else
		return array('ok'=>false, 'error'=>'problems with this message: '.$result);
}
开发者ID:rczeus,项目名称:Rapid-Coffee,代码行数:54,代码来源:add_message.php

示例5: testPut

 public function testPut()
 {
     $message = new Message();
     $message->setId(1);
     $message->setSubject('Un message');
     $message->setContent('Bonjour. Une modification');
     $message->setDatePost('2012-12-14 19:45:45');
     $message->setIdSender(1);
     $message->setIdReceiver(3);
     $messageMapper = new MessageMapper();
     $messageMapper->setId(1);
     $messageMapper->updateMessage($message);
     $this->assertEquals($message, $messageMapper->selectMessage());
 }
开发者ID:noxa02,项目名称:REST_ANNONCE,代码行数:14,代码来源:MessageMapperTest.php

示例6: Message

            
			            <select ref="msgids" model="messages" appearance="placard">
<?php 
for ($i = 0; $i < 10 && $current_page * 10 + $i < $num_messages; $i++) {
    $message = new Message();
    $current_message = $num_messages - ($current_page * 10 + $i);
    $message_uid = imap_uid($mbox, $current_message);
    $headers = imap_headerinfo($mbox, $current_message);
    $from = $headers->from[0]->personal ? $headers->from[0]->personal : $headers->from[0]->mailbox;
    $message->setFrom($from);
    $fromBlock = "<span class=\"subdued\">" . htmlspecialchars($message->getFrom()) . "</span>";
    if ($headers->Unseen == 'U') {
        //Not read
        $fromBlock = "<strong>" . htmlspecialchars($message->getFrom()) . "</strong>";
    }
    $message->setSubject($headers->subject);
    $date = strtotime($headers->date);
    $now = time();
    $minutes_between = ($now - $date) / 60;
    if ($minutes_between < 60) {
        $display_date = round(($now - $date) / 60) . 'm ago';
    } else {
        if ($minutes_between < 60 * 24) {
            $display_date = date('g:i a', $date);
        } else {
            $display_date = date('D g:i a', $date);
        }
    }
    ?>
				<item>
				<placard layout="template">
开发者ID:palako,项目名称:mobilewebmail,代码行数:30,代码来源:index.php

示例7: sendMessage

 public function sendMessage()
 {
     if (isset($_POST['send-msg'])) {
         $to = $_POST['msgTo'];
         $msg = new Message();
         $msg->setTo($to);
         $currentUser = wp_get_current_user();
         $msg->setFrom($currentUser->ID);
         $msg->setSubject($_POST['subject']);
         $msg->setMessage($_POST['message']);
         $msg->send();
         $this->redirect(admin_url('admin.php?page=vmp-msgs'));
     }
 }
开发者ID:ArRolin,项目名称:WP-Message-Plugin,代码行数:14,代码来源:vmp-admin.class.php

示例8: 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

示例9: sendSimpleMessage

 /**
  * function sendSimpleMessage
  * primary function for sending messages via array
  *
  * @return void
  * @author Sean Grove
  **/
 public static function sendSimpleMessage($messageArray, $options = null)
 {
     // TODO: allow an email copy of the message to be sent out
     sfContext::getInstance()->getLogger()->log("message:" . print_r($messageArray, true));
     sfContext::getInstance()->getLogger()->log("options:" . print_r($options, true));
     if (!isset($messageArray["message_type"])) {
         $messageArray["message_type"] = 1;
     }
     sfContext::getInstance()->getLogger()->log('sending Message, owner sender');
     $message = new Message();
     $message->setSenderId($messageArray["from"]);
     sfContext::getInstance()->getLogger()->log('set from: ' . $messageArray["from"]);
     $message->setOwnerId($messageArray["owner"]);
     $message->setRecipientId($messageArray["to"]);
     $message->setParentId($messageArray["parent"]);
     $message->setSubject($messageArray["subject"]);
     $message->setBody($messageArray["text"]);
     $message->setHtmlBody('me');
     $message->setFolder($messageArray["folder"]);
     $message->setMessageType($messageArray["message_type"]);
     $message->save();
     if ($message->getMessageType() == 21) {
         EventUserPeer::addUser($message->getUuid(), $options["event_id"], $messageArray["from"], $options["points"], $options["comment"], $options["status"]);
     }
     if (isset($options["copyTo"]) && $options["copyTo"] == "sent") {
         sfContext::getInstance()->getLogger()->log('sending Message, owner recipient');
         $message2 = array();
         $message2["from"] = $messageArray["from"];
         $message2["owner"] = $messageArray["from"];
         $message2["to"] = $messageArray["to"];
         $message2["parent"] = $messageArray["parent"];
         $message2["subject"] = $messageArray["subject"];
         $message2["text"] = $messageArray["text"];
         $message2["folder"] = "sent";
         self::sendSimpleMessage($message2);
     }
     if (!isset($options["notify"]) || $options["notify"] == true) {
         $sender = $message->getsfGuardUserRelatedBySenderId()->getProfile();
         $recipient = $message->getsfGuardUserRelatedByRecipientId()->getProfile();
         $text = '"' . $message->getSubject() . ' :: ' . $message->getBody() . '"';
         $notification = 'New message from ' . $sender->getFullName() . ' on Cothink! ';
         $notification .= $text;
         $recipient->notify($notification);
     }
     sfContext::getInstance()->getLogger()->log('message sent');
 }
开发者ID:sgrove,项目名称:cothinker,代码行数:53,代码来源:MessagePeer.php

示例10: testGetSetSubject

 public function testGetSetSubject()
 {
     $message = new Message();
     $message->setSubject('Coucou');
     $this->assertEquals('Coucou', $message->getSubject());
 }
开发者ID:noxa02,项目名称:REST_ANNONCE,代码行数:6,代码来源:MessageTest.php

示例11: send

    /**
     * Send an email using a Transactional email service
     * or native PHP as a fallback.
     *
     * @param array  $attributes  A list of attributes for sending
     * @return bool on success
     */
    public static function send($attributes = array())
    {
        /*
        |--------------------------------------------------------------------------
        | Required attributes
        |--------------------------------------------------------------------------
        |
        | We first need to ensure we have the minimum fields necessary to send
        | an email.
        |
        */
        $required = array_intersect_key($attributes, array_flip(self::$required));

        if (count($required) >= 3) {

            /*
            |--------------------------------------------------------------------------
            | Load handler from config
            |--------------------------------------------------------------------------
            |
            | We check the passed data for a mailer + key first, and then fall back
            | to the global Statamic config.
            |
            */
            $email_handler     = array_get($attributes, 'email_handler', Config::get('email_handler', null));
            $email_handler_key = array_get($attributes, 'email_handler_key', Config::get('email_handler_key', null));

            if (in_array($email_handler, self::$email_handlers) && $email_handler_key) {

                /*
                |--------------------------------------------------------------------------
                | Initialize Stampie
                |--------------------------------------------------------------------------
                |
                | Stampie provides numerous adapters for popular email handlers, such as
                | Mandrill, Postmark, and SendGrid. Each is written as an abstract
                | interface in an Adapter Pattern.
                |
                */
                $mailer = self::initializeEmailHandler($email_handler, $email_handler_key);

                /*
                |--------------------------------------------------------------------------
                | Initialize Message class
                |--------------------------------------------------------------------------
                |
                | The message class is an implementation of the Stampie MessageInterface
                |
                */
                $email = new Message($attributes['to']);

                /*
                |--------------------------------------------------------------------------
                | Set email attributes
                |--------------------------------------------------------------------------
                |
                | I hardly think this requires much explanation.
                |
                */
                $email->setFrom($attributes['from']);

                $email->setSubject($attributes['subject']);

                if (isset($attributes['text'])) {
                    $email->setText($attributes['text']);
                }

                if (isset($attributes['html'])) {
                    $email->setHtml($attributes['html']);
                }

                if (isset($attributes['cc'])) {
                    $email->setCc($attributes['cc']);
                }

                if (isset($attributes['bcc'])) {
                    $email->setBcc($attributes['bcc']);
                }

                if (isset($attributes['headers'])) {
                    $email->setHeaders($attributes['headers']);
                }

                $mailer->send($email);

                return true;

            } else {

                /*
                |--------------------------------------------------------------------------
                | Native PHP Mail
                |--------------------------------------------------------------------------
//.........这里部分代码省略.........
开发者ID:jalmelb,项目名称:24hl2015,代码行数:101,代码来源:email.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: send

 /**
  * Send an email using a Transactional email service
  * or native PHP as a fallback.
  *
  * @param array  $attributes  A list of attributes for sending
  * @return bool on success
  */
 public static function send($attributes = array())
 {
     /*
     |--------------------------------------------------------------------------
     | Required attributes
     |--------------------------------------------------------------------------
     |
     | We first need to ensure we have the minimum fields necessary to send
     | an email.
     |
     */
     $required = array_intersect_key($attributes, array_flip(self::$required));
     if (count($required) >= 3) {
         /*
         |--------------------------------------------------------------------------
         | Load handler from config
         |--------------------------------------------------------------------------
         |
         | We check the passed data for a mailer + key first, and then fall back
         | to the global Statamic config.
         |
         */
         $email_handler = array_get($attributes, 'email_handler', Config::get('email_handler', null));
         $email_handler_key = array_get($attributes, 'email_handler_key', Config::get('email_handler_key', null));
         if (in_array($email_handler, self::$email_handlers) && $email_handler_key) {
             /*
             |--------------------------------------------------------------------------
             | Initialize Stampie
             |--------------------------------------------------------------------------
             |
             | Stampie provides numerous adapters for popular email handlers, such as
             | Mandrill, Postmark, and SendGrid. Each is written as an abstract
             | interface in an Adapter Pattern.
             |
             */
             $mailer = self::initializeEmailHandler($email_handler, $email_handler_key);
             /*
             |--------------------------------------------------------------------------
             | Initialize Message class
             |--------------------------------------------------------------------------
             |
             | The message class is an implementation of the Stampie MessageInterface
             |
             */
             $email = new Message($attributes['to']);
             /*
             |--------------------------------------------------------------------------
             | Set email attributes
             |--------------------------------------------------------------------------
             |
             | I hardly think this requires much explanation.
             |
             */
             $email->setFrom($attributes['from']);
             $email->setSubject($attributes['subject']);
             if (isset($attributes['text'])) {
                 $email->setText($attributes['text']);
             }
             if (isset($attributes['html'])) {
                 $email->setHtml($attributes['html']);
             }
             if (isset($attributes['cc'])) {
                 $email->setCc($attributes['cc']);
             }
             if (isset($attributes['bcc'])) {
                 $email->setBcc($attributes['bcc']);
             }
             if (isset($attributes['headers'])) {
                 $email->setHeaders($attributes['headers']);
             }
             $mailer->send($email);
             return true;
         } else {
             /*
             |--------------------------------------------------------------------------
             | Native PHP Mail
             |--------------------------------------------------------------------------
             |
             | We're utilizing the popular PHPMailer class to handle the messy
             | email headers and do-dads. Emailing from PHP in general isn't the best
             | idea known to man, so this is really a lackluster fallback.
             |
             */
             $email = new PHPMailer(true);
             $email->IsMAIL();
             $email->CharSet = 'UTF-8';
             $email->AddAddress($attributes['to']);
             $email->From = $attributes['from'];
             $email->FromName = $attributes['from'];
             $email->Subject = $attributes['subject'];
             if (isset($attributes['text'])) {
                 $email->AltBody = $attributes['text'];
             }
//.........这里部分代码省略.........
开发者ID:nob,项目名称:joi,代码行数:101,代码来源:email.php

示例14: mailInvoiceContract

 public function mailInvoiceContract($sender,$reciver,$subject,$body,$fileData,$title){
     try
     {
         $image_data=$fileData;
         $image_content_id=$title;
         $message = new Message();
         $message->setSender($sender);
         $message->addTo($reciver);
         $message->setSubject($subject);
         $message->setTextBody($body);
         $message->addAttachment($title.'.docx', $image_data, $image_content_id);
         $message->send();
     } catch (InvalidArgumentException $e) {
         echo $e->getMessage();
     }
 }
开发者ID:Rajagunasekaran,项目名称:BACKUP,代码行数:16,代码来源:Mdl_eilib_invoice_contract.php

示例15: newMessage

 /**
  * Compose a new message, and process new message submissions
  * @parm int $reply message ID this message is in reply to [optional] only used to pre-populate subject and recipient
  * @return void
  */
 private function newMessage($reply = 0)
 {
     $this->registry->getObject('template')->buildFromTemplates('header.tpl.php', 'messages/create.tpl.php', 'footer.tpl.php');
     require_once FRAMEWORK_PATH . 'models/relationships.php';
     $relationships = new Relationships($this->registry);
     if (isset($_POST) && count($_POST) > 0) {
         $network = $relationships->getNetwork($this->registry->getObject('authenticate')->getUser()->getUserID());
         $recipient = intval($_POST['recipient']);
         if (in_array($recipient, $network)) {
             // this additional check may not be something we require for private messages?
             require_once FRAMEWORK_PATH . 'models/message.php';
             $message = new Message($this->registry, 0);
             $message->setSender($this->registry->getObject('authenticate')->getUser()->getUserID());
             $message->setRecipient($recipient);
             $message->setSubject($this->registry->getObject('db')->sanitizeData($_POST['subject']));
             $message->setMessage($this->registry->getObject('db')->sanitizeData($_POST['message']));
             $message->save();
             // email notification to the recipient perhaps??
             // confirm, and redirect
             $url = $this->registry->getObject('url')->buildURL(array('messages'), '', false);
             $this->registry->redirectUser($url, 'Message sent', 'The message has been sent');
         } else {
             $this->registry->errorPage('Invalid recipient', 'Sorry, you can only send messages to your recipients');
         }
     } else {
         $cache = $relationships->getByUser($this->registry->getObject('authenticate')->getUser()->getUserID());
         $this->registry->getObject('template')->getPage()->addTag('recipients', array('SQL', $cache));
         if ($reply > 0) {
             require_once FRAMEWORK_PATH . 'models/message.php';
             $message = new Message($this->registry, $reply);
             if ($message->getRecipient() == $this->registry->getObject('authenticate')->getUser()->getUserID()) {
                 $this->registry->getObject('template')->getPage()->addAdditionalParsingData('recipients', 'ID', $message->getSender(), 'opt', "selected='selected'");
                 $this->registry->getObject('template')->getPage()->addTag('subject', 'Re: ' . $message->getSubject());
             } else {
                 $this->registry->getObject('template')->getPage()->addTag('subject', '');
             }
         } else {
             $this->registry->getObject('template')->getPage()->addTag('subject', '');
         }
     }
 }
开发者ID:simontakite,项目名称:cookbooks,代码行数:46,代码来源:controller.php


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