本文整理汇总了PHP中Swift_Message::NewInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Swift_Message::NewInstance方法的具体用法?PHP Swift_Message::NewInstance怎么用?PHP Swift_Message::NewInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Swift_Message
的用法示例。
在下文中一共展示了Swift_Message::NewInstance方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Device
<?php
require_once 'db.inc.php';
require_once 'facilities.inc.php';
require_once 'swiftmailer/swift_required.php';
$device = new Device();
$devList = $device->GetDevicesbyAge($config->ParameterArray["NewInstallsPeriod"]);
// If any port other than 25 is specified, assume encryption and authentication
if ($config->ParameterArray['SMTPPort'] != 25) {
$transport = Swift_SmtpTransport::newInstance()->setHost($config->ParameterArray['SMTPServer'])->setPort($config->ParameterArray['SMTPPort'])->setEncryption('ssl')->setUsername($config->ParameterArray['SMTPUser'])->setPassword($config->ParameterArray['SMTPPassword']);
} else {
$transport = Swift_SmtpTransport::newInstance()->setHost($config->ParameterArray['SMTPServer'])->setPort($config->ParameterArray['SMTPPort']);
}
$mailer = Swift_Mailer::newInstance($transport);
$message = Swift_Message::NewInstance()->setSubject(__("Recent Data Center Installations Report"));
// Set from address
try {
$message->setFrom($config->ParameterArray['MailFromAddr']);
} catch (Swift_RfcComplianceException $e) {
$error .= __("MailFrom") . ": <span class=\"errmsg\">" . $e->getMessage() . "</span><br>\n";
}
// Add data center team to the list of recipients
try {
$message->addTo($config->ParameterArray['FacMgrMail']);
} catch (Swift_RfcComplianceException $e) {
$error .= __("Facility Manager email address") . ": <span class=\"errmsg\">" . $e->getMessage() . "</span><br>\n";
}
$logo = getcwd() . '/images/' . $config->ParameterArray["PDFLogoFile"];
$logo = $message->embed(Swift_Image::fromPath($logo)->setFilename('logo.png'));
$htmlMessage = sprintf("<!doctype html><html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><meta http-equiv=\"CACHE-CONTROL\" content=\"NO-CACHE\"><meta http-equiv=\"expires\" content=\"Mon, 01 Jan 1997 01:00:00 GMT\"><meta http-equiv=\"PRAGMA\" content=\"NO-CACHE\"><title>ITS Data Center Inventory</title></head><body><div id=\"header\" style=\"padding: 5px 0;background: %s;\"><center><img src=\"%s\"></center></div><div class=\"page\"><p><h3>Installations in the Past 7 Days</h3>\n", $config->ParameterArray["HeaderColor"], $logo);
$htmlMessage .= sprintf("<p>The following systems have been entered into openDCIM, with an Install Date set to within the past %d days. Please review these entries to determine if follow-up documentation is required.</p>", $config->ParameterArray["NewInstallsPeriod"]);
示例2: catch
if (isset($_REQUEST['requestid']) && $_REQUEST['requestid'] > 0) {
$req->RequestID = $_REQUEST['requestid'];
$req->GetRequest();
$contact->PersonID = $req->RequestorID;
$contact->GetPerson();
}
$tmpContact->PersonID = $_POST["requestorid"];
$tmpContact->GetPerson();
// If any port other than 25 is specified, assume encryption and authentication
if ($config->ParameterArray['SMTPPort'] != 25) {
$transport = Swift_SmtpTransport::newInstance()->setHost($config->ParameterArray['SMTPServer'])->setPort($config->ParameterArray['SMTPPort'])->setEncryption('ssl')->setUsername($config->ParameterArray['SMTPUser'])->setPassword($config->ParameterArray['SMTPPassword']);
} else {
$transport = Swift_SmtpTransport::newInstance()->setHost($config->ParameterArray['SMTPServer'])->setPort($config->ParameterArray['SMTPPort']);
}
$mailer = Swift_Mailer::newInstance($transport);
$message = Swift_Message::NewInstance()->setSubject($config->ParameterArray['MailSubject']);
// Set from address
try {
$message->setFrom($config->ParameterArray['MailFromAddr']);
} catch (Swift_RfcComplianceException $e) {
$error .= __("MailFrom") . ": <span class=\"errmsg\">" . $e->getMessage() . "</span><br>\n";
}
// Add rack requestor to the list of recipients
try {
$message->addTo($tmpContact->Email);
} catch (Swift_RfcComplianceException $e) {
$error .= __("Check contact details for") . " <a href=\"usermgr.php?PersonID={$tmpContact->PersonID}\">{$tmpContact->LastName}, {$tmpContact->FirstName}</a>: <span class=\"errmsg\">" . $e->getMessage() . "</span><br>\n";
}
// Add data center team to the list of recipients
try {
$message->addTo($config->ParameterArray['MailToAddr']);
示例3: catch
<?php
require_once 'db.inc.php';
require_once 'facilities.inc.php';
require_once 'swiftmailer/swift_required.php';
// If any port other than 25 is specified, assume encryption and authentication
if ($config->ParameterArray['SMTPPort'] != 25) {
$transport = Swift_SmtpTransport::newInstance()->setHost($config->ParameterArray['SMTPServer'])->setPort($config->ParameterArray['SMTPPort'])->setEncryption('ssl')->setUsername($config->ParameterArray['SMTPUser'])->setPassword($config->ParameterArray['SMTPPassword']);
} else {
$transport = Swift_SmtpTransport::newInstance()->setHost($config->ParameterArray['SMTPServer'])->setPort($config->ParameterArray['SMTPPort']);
}
$mailer = Swift_Mailer::newInstance($transport);
$message = Swift_Message::NewInstance()->setSubject(__("Data Center Reserved Space Report"));
// Set from address
try {
$message->setFrom($config->ParameterArray['MailFromAddr']);
} catch (Swift_RfcComplianceException $e) {
$error .= __("MailFrom") . ": <span class=\"errmsg\">" . $e->getMessage() . "</span><br>\n";
}
// Add data center team to the list of recipients
try {
$message->addTo($config->ParameterArray['FacMgrMail']);
} catch (Swift_RfcComplianceException $e) {
$error .= __("Facility Manager email address") . ": <span class=\"errmsg\">" . $e->getMessage() . "</span><br>\n";
}
$logo = getcwd() . '/images/' . $config->ParameterArray["PDFLogoFile"];
$logo = $message->embed(Swift_Image::fromPath($logo)->setFilename('logo.png'));
$style = "\n<style type=\"text/css\">\n@media print {\n\th2 {\n\t\tpage-break-before: always;\n\t}\n}\n</style>";
$htmlMessage = sprintf("<!doctype html><html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><title>%s</title>%s</head><body><div id=\"header\" style=\"padding: 5px 0;background: %s;\"><center><img src=\"%s\"></center></div><div class=\"page\"><p>\n", __("Data Center Inventory Reservations"), $style, $config->ParameterArray["HeaderColor"], $logo);
$datedList = Device::GetReservationsByDate();
$ownerList = array();
示例4: sendorder
function sendorder()
{
$check = Validate::factory($_POST)->label('fio', 'ФИО')->label('address', 'адрес')->label('phone', 'телефон')->label('email', 'EMail')->rule('fio', 'not_empty')->rule('address', 'not_empty')->rule('phone', 'not_empty')->rule('phone', 'phone')->rule('email', 'not_empty')->rule('email', 'email');
if ($check->check()) {
//$order = ORM::factory('good', $_POST['orderid'])->as_array();
$session = Session::instance();
$_SESSION =& $session->as_array();
$orders = '<b>Наименования:</b><br>';
$price = 0;
foreach ($_SESSION['orders'] as $k => $v) {
$orders .= $_SESSION['orders'][$k]['name'] . ' (ID: ' . $_SESSION['orders'][$k]['id'] . ') - ' . $_SESSION['orders'][$k]['price'] . ' грн. (' . $_SESSION['orders'][$k]['count'] . ' ' . $_SESSION['orders'][$k]['select'] . ')<br>';
$cof = $_SESSION['orders'][$k]['select'] == 'kg' ? $_SESSION['orders'][$k]['count'] : $_SESSION['orders'][$k]['count'] / 1000;
$price += $_SESSION['orders'][$k]['price'] * $cof;
}
$text = '<b>ФИО:</b> ' . $_POST['fio'] . '<br>
<b>Адрес:</b> ' . $_POST['address'] . '<br>
<b>Телефон:</b> ' . $_POST['phone'] . '<br>
<b>EMail:</b> ' . $_POST['email'] . '<br>' . $orders . '<p><b>Итоговая цена без доставки:</b> ' . $price;
$mailer = email::connect();
$message = Swift_Message::NewInstance('Новый заказ', $text, 'text/html', 'utf-8');
$message->setTo('info@sg.od.ua');
$message->setFrom('no-reply@sg.od.ua');
$mailer->send($message);
Session::instance()->delete('orders');
return TRUE;
} else {
return strtolower(implode(' и ', $check->errors('')));
}
}
示例5: ESX
require_once 'db.inc.php';
require_once 'facilities.inc.php';
require_once 'swiftmailer/swift_required.php';
$esx = new ESX();
$dev = new Device();
$dept = new Department();
$error = "";
// If any port other than 25 is specified, assume encryption and authentication
if ($config->ParameterArray['SMTPPort'] != 25) {
$transport = Swift_SmtpTransport::newInstance()->setHost($config->ParameterArray['SMTPServer'])->setPort($config->ParameterArray['SMTPPort'])->setEncryption('ssl')->setUsername($config->ParameterArray['SMTPUser'])->setPassword($config->ParameterArray['SMTPPassword']);
} else {
$transport = Swift_SmtpTransport::newInstance()->setHost($config->ParameterArray['SMTPServer'])->setPort($config->ParameterArray['SMTPPort']);
}
$mailer = Swift_Mailer::newInstance($transport);
$message = Swift_Message::NewInstance()->setSubject(__("Virtual Machine Inventory Exception Report"));
// Set from address
try {
$message->setFrom($config->ParameterArray['MailFromAddr']);
$message->SetReplyTo($config->ParameterArray["MailToAddr"]);
} catch (Swift_RfcComplianceException $e) {
$error .= __("MailFrom") . ": <span class=\"errmsg\">" . $e->getMessage() . "</span><br>\n";
}
// Add people to recipient list
try {
$message->setTo($config->ParameterArray['MailToAddr']);
/* // Add additional recipients below this section using the following examples
* // Using addTo() to add recipients iteratively
* $message->addTo('person1@example.org');
* $message->addTo('person2@example.org', 'Person 2 Name');
*/
示例6: catch
<?php
require_once 'db.inc.php';
require_once 'facilities.inc.php';
require_once 'swiftmailer/swift_required.php';
// If any port other than 25 is specified, assume encryption and authentication
if ($config->ParameterArray['SMTPPort'] != 25) {
$transport = Swift_SmtpTransport::newInstance()->setHost($config->ParameterArray['SMTPServer'])->setPort($config->ParameterArray['SMTPPort'])->setEncryption('ssl')->setUsername($config->ParameterArray['SMTPUser'])->setPassword($config->ParameterArray['SMTPPassword']);
} else {
$transport = Swift_SmtpTransport::newInstance()->setHost($config->ParameterArray['SMTPServer'])->setPort($config->ParameterArray['SMTPPort']);
}
$mailer = Swift_Mailer::newInstance($transport);
$message = Swift_Message::NewInstance()->setSubject(__("Data Center Switch Capacity Exceptions Report"));
// Set from address
try {
$message->setFrom($config->ParameterArray['MailFromAddr']);
} catch (Swift_RfcComplianceException $e) {
$error .= __("MailFrom") . ": <span class=\"errmsg\">" . $e->getMessage() . "</span><br>\n";
}
// Add data center team to the list of recipients
try {
$message->addTo($config->ParameterArray['FacMgrMail']);
} catch (Swift_RfcComplianceException $e) {
$error .= __("Facility Manager email address") . ": <span class=\"errmsg\">" . $e->getMessage() . "</span><br>\n";
}
$logo = getcwd() . '/images/' . $config->ParameterArray["PDFLogoFile"];
$logo = $message->embed(Swift_Image::fromPath($logo)->setFilename('logo.png'));
$htmlMessage = sprintf("<!doctype html><html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><title>ITS Data Center Inventory</title></head><body><div id=\"header\" style=\"padding: 5px 0;background: %s;\"><center><img src=\"%s\"></center></div><div class=\"page\"><p>\n", $config->ParameterArray["HeaderColor"], $logo);
$htmlMessage .= sprintf("<p>The following switches are near full capacity per documentation.</p>");
$devList = Device::GetSwitchesToReport();
$lastDC = null;