本文整理汇总了PHP中Message::setTo方法的典型用法代码示例。如果您正苦于以下问题:PHP Message::setTo方法的具体用法?PHP Message::setTo怎么用?PHP Message::setTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Message
的用法示例。
在下文中一共展示了Message::setTo方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendSms
/**
* Sends a single sms
*
* @return mixed
*/
public function sendSms($message, $number)
{
try {
$smsghMessage = new \Message();
$smsghMessage->setContent($message);
$smsghMessage->setTo($number);
$smsghMessage->setFrom($this->getSenderName());
$smsghMessage->setRegisteredDelivery(true);
$messageResponse = $this->getApiMessage()->sendMessage($smsghMessage);
if ($messageResponse instanceof \MessageResponse) {
echo $messageResponse->getStatus();
} elseif ($messageResponse instanceof \HttpResponse) {
echo "\nServer Response Status : " . $messageResponse->getStatus();
}
} catch (\Exception $ex) {
dd($ex);
}
}
示例2: array
$to = array(
'Ken Bergquist' => 'kbergqui@email.unc.edu',
'Lasheaka McClellan' => 'Lasheaka.McClellan@medicine.ufl.edu',
'Tyre Johnson' => 'tyre.johnson@medicine.ufl.edu',
'Dona-Marie Mintz' => 'Dona-Marie.Mintz@medicine.ufl.edu',
'Nicholas Slater' => 'Nicholas.Slater@medicine.ufl.edu'
);
//$to = array('Ken Bergquist' => 'kbergqui@email.unc.edu');
$from = array('Ken Bergquist' => 'kbergqui@email.unc.edu');
$subject = "HCV-TARGET 2 Site Source Upload Notification";
$email = new Message ();
foreach ($from as $name => $address) {
$email->setFrom($address);
$email->setFromName($name);
}
$email->setSubject($subject);
$email->setBody($html);
foreach ($to as $name => $address) {
$email->setTo($address);
$email->setToName($name);
if (!$debug) {
if (!$email->send()) {
error_log("ERROR: Failed to send Site Source Upload digest");
}
}
}
d($email);
} else {
error_log("NOTICE: No site source uploads were available to be digested");
}
}
示例3: unserialize
$errMsg = 'Please complete the \'To\' and \'Subject\' fields.';
}
}
if (isset($_GET['action'])) {
$action = $_GET['action'];
} else {
$action = 'new';
}
if (isset($_SESSION['currentMessage'])) {
$message = unserialize($_SESSION['currentMessage']);
} else {
$message = new Message();
}
switch ($action) {
case 'reply':
$message->setTo($message->getFrom(true));
$message->setCc('');
break;
case 'replyall':
$message->setTo($message->getFrom(true));
break;
case 'forward':
$message->setTo('');
$message->setCc('');
break;
}
header("Content-Type: application/x-blueprint+xml");
header("Cache-Control: no-cache");
echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
?>
<page style="list">
示例4: do_sendit
//.........这里部分代码省略.........
$expireDays = 3; // set the SendIt to expire in this many days
/**
* $file_location:
* 1 = ephemeral, will be deleted on $expireDate
* 2 = export file, visible only to rights in file repository
*/
$file_location = 2;
$send = 1; // always send download confirmation
$expireDate = date('Y-m-d H:i:s', strtotime("+$expireDays days"));
$expireYear = substr($expireDate, 0, 4);
$expireMonth = substr($expireDate, 5, 2);
$expireDay = substr($expireDate, 8, 2);
$expireHour = substr($expireDate, 11, 2);
$expireMin = substr($expireDate, 14, 2);
// Add entry to sendit_docs table
$query = "INSERT INTO redcap_sendit_docs (doc_name, doc_orig_name, doc_type, doc_size, send_confirmation, expire_date, username,
location, docs_id, date_added)
VALUES ('$originalFilename', '" . prep($originalFilename) . "', '$docs_type', '$docs_size', $send, '$expireDate', '" . prep($userid) . "',
$file_location, $docs_id, '" . NOW . "')";
db_query($query);
$newId = db_insert_id();
$logDescrip = "Send file from file repository (Send-It)";
log_event($query, "redcap_sendit_docs", "MANAGE", $newId, "document_id = $newId", $logDescrip);
// Set email subject
$subject = "[PRIORITIZE] " . $comment;
$subject = html_entity_decode($subject, ENT_QUOTES);
// Set email From address
$from = array('Ken Bergquist' => 'kbergqui@email.unc.edu');
// Begin set up of email to send to recipients
$email = new Message();
foreach ($from as $name => $address) {
$email->setFrom($address);
$email->setFromName($name);
}
$email->setSubject($subject);
// Loop through each recipient and send email
foreach ($to as $name => $address) {
// If a non-blank email address
if (trim($address) != '') {
// create key for unique url
$key = strtoupper(substr(uniqid(md5(mt_rand())), 0, 25));
// create password
$pwd = generateRandomHash(8, false, true);
$query = "INSERT INTO redcap_sendit_recipients (email_address, sent_confirmation, download_date, download_count, document_id, guid, pwd)
VALUES ('$address', 0, NULL, 0, $newId, '$key', '" . md5($pwd) . "')";
$q = db_query($query);
// Download URL
$url = APP_PATH_WEBROOT_FULL . 'redcap_v' . $redcap_version . '/SendIt/download.php?' . $key;
// Message from sender
$note = "$comment for $today";
// Get YMD timestamp of the file's expiration time
$expireTimestamp = date('Y-m-d H:i:s', mktime($expireHour, $expireMin, 0, $expireMonth, $expireDay, $expireYear));
// Email body
$body = "<html><body style=\"font-family:Arial;font-size:10pt;\">
$yourName {$lang['sendit_51']} \"$originalFilename\" {$lang['sendit_52']} " .
date('l', mktime($expireHour, $expireMin, 0, $expireMonth, $expireDay, $expireYear)) . ",
" . DateTimeRC::format_ts_from_ymd($expireTimestamp) . "{$lang['period']}
{$lang['sendit_53']}<br><br>
{$lang['sendit_54']}<br>
<a href=\"$url\">$url</a><br><br>
$note
<br>-----------------------------------------------<br>
{$lang['sendit_55']} " . CONSORTIUM_WEBSITE_DOMAIN . ".
</body></html>";
// Construct email and send
$email->setTo($address);
$email->setToName($name);
$email->setBody($body);
if ($email->send()) {
// Now send follow-up email containing password
$bodypass = "<html><body style=\"font-family:Arial;font-size:10pt;\">
{$lang['sendit_50']}<br><br>
$pwd<br><br>
</body></html>";
$email->setSubject("Re: $subject");
$email->setBody($bodypass);
sleep(2); // Hold for a second so that second email somehow doesn't reach the user first
$email->send();
} else {
error_log("ERROR: pid=$project_id: Email to $name <$address> NOT SENT");
}
}
}
}
unset($table_csv);
}
}
示例5: BasicAuth
<?php
// Let us test the SDK
require './Smsgh/Api.php';
$auth = new BasicAuth("user123", "password123");
// instance of ApiHost
$apiHost = new ApiHost($auth);
// instance of AccountApi
$accountApi = new AccountApi($apiHost);
// Get the account profile
// Let us try to send some message
$messagingApi = new MessagingApi($apiHost);
try {
// Send a quick message
$messageResponse = $messagingApi->sendQuickMessage("Husby", "+2332432191768", "I love you dearly Honey. See you in the evening...");
$mesg = new Message();
$mesg->setContent("I will eat the beautiful Food you have");
$mesg->setTo("+233244219234");
$mesg->setFrom("+233204567867");
$mesg->setRegisteredDelivery(true);
// Let us say we want to send the message 3 days from today
$mesg->setTime(date('Y-m-d H:i:s', strtotime('+1 week')));
$messageResponse = $messagingApi->sendMessage($mesg);
if ($messageResponse instanceof MessageResponse) {
echo $messageResponse->getStatus();
} elseif ($messageResponse instanceof HttpResponse) {
echo "\nServer Response Status : " . $messageResponse->getStatus();
}
} catch (Exception $ex) {
echo $ex->getTraceAsString();
}
示例6: 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);
}
示例7: BasicAuth
require 'Smsgh/Api.php';
//$auth = new BasicAuth("yralkzfn", "znbzlsho");
$auth = new BasicAuth("obxffxqt", "wmqimxzt");
// instance of ApiHost
$apiHost = new ApiHost($auth);
// instance of AccountApi
$accountApi = new AccountApi($apiHost);
// Get the account profile
// Let us try to send some message
$messagingApi = new MessagingApi($apiHost);
try {
// Send a quick message
//$messageResponse = $messagingApi->sendQuickMessage("Husby", "+2332432191768", "I love you dearly Honey. See you in the evening...");
$mesg = new Message();
$mesg->setContent($newMessage);
$mesg->setTo($customer);
$mesg->setFrom("+233543344100");
$mesg->setRegisteredDelivery(true);
// Let us say we want to send the message 3 days from today
//$mesg->setTime(date('Y-m-d H:i:s', strtotime('+1 week')));
$messageResponse = $messagingApi->sendMessage($mesg);
if ($messageResponse instanceof MessageResponse) {
echo '{"result": 1, "message": "' . $messageResponse->getStatus() . '"}';
return;
//echo $messageResponse->getStatus();
} elseif ($messageResponse instanceof HttpResponse) {
echo '{"result": 0, "message": "' . $messageResponse->getStatus() . '"}';
return;
// echo "\nServer Response Status : " . $messageResponse->getStatus();
}
} catch (Exception $ex) {
示例8: header
<?php
require_once 'autoload.php';
include 'checksession.php';
if (!checksession()) {
header('Location: login.php');
}
$au = new Approval();
$commallowed = array('2', '17');
if (isset($_SESSION['operatorid'])) {
$au->setValue('operatorid', $_SESSION['operatorid']);
$me = new Message();
$me->setTo($_SESSION['operatorid']);
$nm = $me->getMessagecount();
} else {
checksession('index.php');
}
echo <<<_END
<!DOCTYPE HTML>
<head>
<meta charset="utf-8" />
<title>Divya Engineering ERP</title>
<link href="js/css/sm-core-css.css" rel="stylesheet" type="text/css" />
<link href="js/css/sm-blue/sm-blue.css" rel="stylesheet" type="text/css" />
<script src="js/jquery-2.1.4.min.js" ></script>
<script src="js/jquery.smartmenus.js" ></script>
<script>
示例9: serialize
$pageNumber = $_GET['page'];
} else {
$pageNumber = 0;
}
$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;
示例10: 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'));
}
}