本文整理汇总了PHP中Utilities::SendEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP Utilities::SendEmail方法的具体用法?PHP Utilities::SendEmail怎么用?PHP Utilities::SendEmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utilities
的用法示例。
在下文中一共展示了Utilities::SendEmail方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: form
/**
* @method POST
*/
function form()
{
// parse request
parse_str($this->request->data, $request);
$siteUniqId = SITE_UNIQ_ID;
$pageUniqId = $request['pageUniqId'];
$body = $request['body'];
$site = Site::GetBySiteUniqId($siteUniqId);
$page = Page::GetByPageUniqId($pageUniqId);
if ($site != null && $page != null) {
$subject = 'RespondCMS: Form Submission [' . $site['Name'] . ': ' . $page['Name'] . ']';
$content = '<h3>Site Information</h3>' . '<table>' . '<tr>' . '<td style="padding: 5px 25px 5px 0;">Site:</td>' . '<td style="padding: 5px 0">' . $site['Name'] . '</td>' . '</tr>' . '<tr>' . '<td style="padding: 5px 25px 5px 0;">Page:</td>' . '<td style="padding: 5px 0">' . $page['Name'] . '</td>' . '</tr>' . '</table>' . '<h3>Form Details</h3>' . $body;
// send an email
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
$headers .= 'From: ' . $site['PrimaryEmail'] . "\r\n" . 'Reply-To: ' . $site['PrimaryEmail'] . "\r\n";
// sends the email
$to = $site['PrimaryEmail'];
$from = $site['PrimaryEmail'];
$fromName = $site['Name'];
Utilities::SendEmail($to, $from, $fromName, $subject, $content);
// return a successful response (200)
return new Tonic\Response(Tonic\Response::OK);
} else {
// unauthorized access
return new Tonic\Response(Tonic\Response::UNAUTHORIZED);
}
}
示例2: SendEmailFromFile
public static function SendEmailFromFile($to, $from, $fromName, $subject, $replace, $file, $site = NULL)
{
$full_file = $file;
if (file_exists($full_file)) {
$content = file_get_contents($full_file);
// walk through and replace values in associative array
foreach ($replace as $key => &$value) {
$content = str_replace($key, $value, $content);
$subject = str_replace($key, $value, $subject);
}
// send email
if ($site != NULL) {
Utilities::SendSiteEmail($site, $to, $from, $fromName, $subject, $content);
} else {
Utilities::SendEmail($to, $from, $fromName, $subject, $content);
}
}
}
示例3: SendEmailFromFile
public static function SendEmailFromFile($to, $from, $fromName, $subject, $replace, $file, $root = '../')
{
$full_file = $root . $file;
if (file_exists($full_file)) {
$content = file_get_contents($full_file);
// walk through and replace values in associative array
foreach ($replace as $key => &$value) {
$content = str_replace($key, $value, $content);
$subject = str_replace($key, $value, $subject);
}
Utilities::SendEmail($to, $from, $fromName, $subject, $content);
}
}