本文整理汇总了PHP中eZMail::setSender方法的典型用法代码示例。如果您正苦于以下问题:PHP eZMail::setSender方法的具体用法?PHP eZMail::setSender怎么用?PHP eZMail::setSender使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZMail
的用法示例。
在下文中一共展示了eZMail::setSender方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendOrderEmail
function sendOrderEmail($params)
{
$ini = eZINI::instance();
if (isset($params['order']) and isset($params['email'])) {
$order = $params['order'];
$email = $params['email'];
$tpl = eZTemplate::factory();
$tpl->setVariable('order', $order);
$templateResult = $tpl->fetch('design:shop/orderemail.tpl');
$subject = $tpl->variable('subject');
$mail = new eZMail();
$emailSender = $ini->variable('MailSettings', 'EmailSender');
if (!$emailSender) {
$emailSender = $ini->variable("MailSettings", "AdminEmail");
}
if ($tpl->hasVariable('content_type')) {
$mail->setContentType($tpl->variable('content_type'));
}
$mail->setReceiver($email);
$mail->setSender($emailSender);
$mail->setSubject($subject);
$mail->setBody($templateResult);
$mailResult = eZMailTransport::send($mail);
$email = $ini->variable('MailSettings', 'AdminEmail');
$mail = new eZMail();
if ($tpl->hasVariable('content_type')) {
$mail->setContentType($tpl->variable('content_type'));
}
$mail->setReceiver($email);
$mail->setSender($emailSender);
$mail->setSubject($subject);
$mail->setBody($templateResult);
$mailResult = eZMailTransport::send($mail);
}
}
示例2: sendConfirmation
function sendConfirmation()
{
if ($this->attribute('status') != eZSubscription::StatusPending) {
return;
}
$res = eZTemplateDesignResource::instance();
$ini = eZINI::instance();
$hostname = eZSys::hostname();
$template = 'design:eznewsletter/sendout/registration.tpl';
$tpl = eZNewsletterTemplateWrapper::templateInit();
$tpl->setVariable('userData', eZUserSubscriptionData::fetch($this->attribute('email')));
$tpl->setVariable('hostname', $hostname);
$tpl->setVariable('subscription', $this);
$tpl->setVariable('subscriptionList', $this->attribute('subscription_list'));
$templateResult = $tpl->fetch($template);
if ($tpl->hasVariable('subject')) {
$subject = $tpl->variable('subject');
}
$mail = new eZMail();
$mail->setSender($ini->variable('MailSettings', 'EmailSender'), $ini->variable('SiteSettings', 'SiteName'));
$mail->setReceiver($this->attribute('email'));
$mail->setBody($templateResult);
$mail->setSubject($subject);
eZMailTransport::send($mail);
}
示例3: execute
function execute( $xml )
{
$template = $xml->getAttribute( 'template' );
$receiverID = $xml->getAttribute( 'receiver' );
$nodeID = $xml->getAttribute( 'node' );
$ini = eZINI::instance();
$mail = new eZMail();
$tpl = eZTemplate::factory();
$node = eZContentObjectTreeNode::fetch( $nodeID );
if ( !$node )
{
$node = eZContentObjectTreeNode::fetch( 2 );
}
$emailSender = $ini->variable( 'MailSettings', 'EmailSender' );
if ( !$emailSender )
$emailSender = $ini->variable( "MailSettings", "AdminEmail" );
$receiver = eZUser::fetch( $receiverID );
if ( !$receiver )
{
$emailReceiver = $emailSender;
}
else
{
$emailReceiver = $receiver->attribute( 'email' );
}
$tpl->setVariable( 'node', $node );
$tpl->setVariable( 'receiver', $receiver );
$body = $tpl->fetch( 'design:' . $template );
$subject = $tpl->variable( 'subject' );
$mail->setReceiver( $emailReceiver );
$mail->setSender( $emailSender );
$mail->setSubject( $subject );
$mail->setBody( $body );
$mailResult = eZMailTransport::send( $mail );
return $mailResult;
}
示例4: checkContentActions
function checkContentActions($module, $class, $object, $version, $contentObjectAttributes, $EditVersion, $EditLanguage)
{
if ($module->isCurrentAction('Cancel')) {
$http = eZHTTPTool::instance();
if ($http->hasPostVariable('RedirectIfDiscarded')) {
eZRedirectManager::redirectTo($module, $http->postVariable('RedirectIfDiscarded'));
} else {
eZRedirectManager::redirectTo($module, '/');
}
$version->removeThis();
$http = eZHTTPTool::instance();
$http->removeSessionVariable("RegisterUserID");
$http->removeSessionVariable('StartedRegistration');
return eZModule::HOOK_STATUS_CANCEL_RUN;
}
if ($module->isCurrentAction('Publish')) {
$userID = $object->attribute('id');
$operationResult = eZOperationHandler::execute('user', 'register', array('user_id' => $userID));
// send feedback
$ini = eZINI::instance();
$tpl = eZTemplate::factory();
$hostname = eZSys::hostname();
$user = eZUser::fetch($userID);
$feedbackTypes = $ini->variableArray('UserSettings', 'RegistrationFeedback');
foreach ($feedbackTypes as $feedbackType) {
switch ($feedbackType) {
case 'email':
// send feedback with the default email type
$mail = new eZMail();
$tpl->resetVariables();
$tpl->setVariable('user', $user);
$tpl->setVariable('object', $object);
$tpl->setVariable('hostname', $hostname);
$templateResult = $tpl->fetch('design:user/registrationfeedback.tpl');
if ($tpl->hasVariable('content_type')) {
$mail->setContentType($tpl->variable('content_type'));
}
$emailSender = $ini->variable('MailSettings', 'EmailSender');
if ($tpl->hasVariable('email_sender')) {
$emailSender = $tpl->variable('email_sender');
} else {
if (!$emailSender) {
$emailSender = $ini->variable('MailSettings', 'AdminEmail');
}
}
$feedbackReceiver = $ini->variable('UserSettings', 'RegistrationEmail');
if ($tpl->hasVariable('email_receiver')) {
$feedbackReceiver = $tpl->variable('email_receiver');
} else {
if (!$feedbackReceiver) {
$feedbackReceiver = $ini->variable('MailSettings', 'AdminEmail');
}
}
if ($tpl->hasVariable('subject')) {
$subject = $tpl->variable('subject');
} else {
$subject = ezpI18n::tr('kernel/user/register', 'New user registered');
}
$mail->setSender($emailSender);
$mail->setReceiver($feedbackReceiver);
$mail->setSubject($subject);
$mail->setBody($templateResult);
$mailResult = eZMailTransport::send($mail);
break;
default:
$registrationFeedbackClass = false;
// load custom registration feedback settings
if ($ini->hasGroup('RegistrationFeedback_' . $feedbackType)) {
if ($ini->hasVariable('RegistrationFeedback_' . $feedbackType, 'File')) {
include_once $ini->variable('RegistrationFeedback_' . $feedbackType, 'File');
}
$registrationFeedbackClass = $ini->variable('RegistrationFeedback_' . $feedbackType, 'Class');
}
// try to call the registration feedback class with function registrationFeedback
if ($registrationFeedbackClass && method_exists($registrationFeedbackClass, 'registrationFeedback')) {
call_user_func(array($registrationFeedbackClass, 'registrationFeedback'), $user, $tpl, $object, $hostname);
} else {
eZDebug::writeWarning("Unknown feedback type '{$feedbackType}'", 'user/register');
}
}
}
$http = eZHTTPTool::instance();
$http->removeSessionVariable("GeneratedPassword");
$http->removeSessionVariable("RegisterUserID");
$http->removeSessionVariable('StartedRegistration');
// if everything is passed, login the user
if ($operationResult['status'] === eZModuleOperationInfo::STATUS_CONTINUE) {
$user->loginCurrent();
}
// check for redirectionvariable
if ($operationResult['status'] === eZModuleOperationInfo::STATUS_CONTINUE || $operationResult['status'] === eZModuleOperationInfo::STATUS_HALTED) {
if ($http->hasSessionVariable('RedirectAfterUserRegister')) {
$module->redirectTo($http->sessionVariable('RedirectAfterUserRegister'));
$http->removeSessionVariable('RedirectAfterUserRegister');
} else {
if ($http->hasPostVariable('RedirectAfterUserRegister')) {
$module->redirectTo($http->postVariable('RedirectAfterUserRegister'));
} else {
$module->redirectTo('/user/success/');
}
//.........这里部分代码省略.........
示例5: sendUserNotification
/**
* Send the notification after registeration
*/
public static function sendUserNotification($userID)
{
eZDebugSetting::writeNotice('Sending approval notification to the user.', 'kernel-user', 'user register');
$user = eZUser::fetch($userID);
$ini = eZINI::instance();
// Send mail
$tpl = eZTemplate::factory();
$tpl->setVariable('user', $user);
$templateResult = $tpl->fetch('design:user/registrationapproved.tpl');
$mail = new eZMail();
if ($tpl->hasVariable('content_type')) {
$mail->setContentType($tpl->variable('content_type'));
}
$emailSender = $ini->variable('MailSettings', 'EmailSender');
if ($tpl->hasVariable('email_sender')) {
$emailSender = $tpl->variable('email_sender');
} else {
if (!$emailSender) {
$emailSender = $ini->variable('MailSettings', 'AdminEmail');
}
}
if ($tpl->hasVariable('subject')) {
$subject = $tpl->variable('subject');
} else {
$subject = ezpI18n::tr('kernel/user/register', 'User registration approved');
}
$mail->setSender($emailSender);
$receiver = $user->attribute('email');
$mail->setReceiver($receiver);
$mail->setSubject($subject);
$mail->setBody($templateResult);
$mailResult = eZMailTransport::send($mail);
return array('status' => eZModuleOperationInfo::STATUS_CONTINUE);
}
示例6: processUserActivation
/**
* Processes user activation
*
* @param eZUser $user
* @param string $password
*/
public static function processUserActivation($user, $password)
{
$ini = eZINI::instance();
$tpl = eZTemplate::factory();
$tpl->setVariable('user', $user);
$tpl->setVariable('object', $user->contentObject());
$tpl->setVariable('hostname', eZSys::hostname());
$tpl->setVariable('password', $password);
// Check whether account activation is required.
$verifyUserType = $ini->variable('UserSettings', 'VerifyUserType');
$sendUserMail = !!$verifyUserType;
// For compatibility with old setting
if ($verifyUserType === 'email' && $ini->hasVariable('UserSettings', 'VerifyUserEmail') && $ini->variable('UserSettings', 'VerifyUserEmail') !== 'enabled') {
$verifyUserType = false;
}
if ($verifyUserType === 'email') {
// Disable user account and send verification mail to the user
$userID = $user->attribute('contentobject_id');
// Create enable account hash and send it to the newly registered user
$hash = md5(mt_rand() . time() . $userID);
if (eZOperationHandler::operationIsAvailable('user_activation')) {
eZOperationHandler::execute('user', 'activation', array('user_id' => $userID, 'user_hash' => $hash, 'is_enabled' => false));
} else {
eZUserOperationCollection::activation($userID, $hash, false);
}
// Log out current user
eZUser::logoutCurrent();
$tpl->setVariable('hash', $hash);
$sendUserMail = true;
} else {
if ($verifyUserType) {
$verifyUserTypeClass = false;
// load custom verify user settings
if ($ini->hasGroup('VerifyUserType_' . $verifyUserType)) {
if ($ini->hasVariable('VerifyUserType_' . $verifyUserType, 'File')) {
include_once $ini->variable('VerifyUserType_' . $verifyUserType, 'File');
}
$verifyUserTypeClass = $ini->variable('VerifyUserType_' . $verifyUserType, 'Class');
}
// try to call the verify user class with function verifyUser
if ($verifyUserTypeClass && method_exists($verifyUserTypeClass, 'verifyUser')) {
$sendUserMail = call_user_func(array($verifyUserTypeClass, 'verifyUser'), $user, $tpl);
} else {
eZDebug::writeWarning("Unknown VerifyUserType '{$verifyUserType}'", 'ngconnect/profile');
}
}
}
// send verification mail to user if email type or custom verify user type returned true
if ($sendUserMail) {
$mail = new eZMail();
$templateResult = $tpl->fetch('design:user/registrationinfo.tpl');
if ($tpl->hasVariable('content_type')) {
$mail->setContentType($tpl->variable('content_type'));
}
$emailSender = $ini->variable('MailSettings', 'EmailSender');
if ($tpl->hasVariable('email_sender')) {
$emailSender = $tpl->variable('email_sender');
} else {
if (!$emailSender) {
$emailSender = $ini->variable('MailSettings', 'AdminEmail');
}
}
$mail->setSender($emailSender);
if ($tpl->hasVariable('subject')) {
$subject = $tpl->variable('subject');
} else {
$subject = ezpI18n::tr('kernel/user/register', 'Registration info');
}
$mail->setSubject($subject);
$mail->setReceiver($user->attribute('email'));
$mail->setBody($templateResult);
eZMailTransport::send($mail);
}
}
示例7: init
/**
* @return bool
*/
function init()
{
if ( $this->hasKickstartData() )
{
$data = $this->kickstartData();
$this->PersistenceList['email_info']['send'] = isset( $data['Send'] ) ? ( $data['Send'] == 'true' ) : true;
$this->PersistenceList['email_info']['user_data'] = isset( $data['UserData'] ) ? $data['UserData'] : $this->defaultUserData;
if ( $this->kickstartContinueNextStep() )
{
if ( $this->PersistenceList['email_info']['send'] )
{
$mailTpl = eZTemplate::factory();
$bodyText = $this->generateRegistration( $mailTpl, $this->PersistenceList['email_info']['user_data'] );
$subject = $mailTpl->variable( 'subject' );
// Fill in E-Mail data and send it
$mail = new eZMail();
$mail->setReceiver( 'registerezsite@ez.no', 'eZ Site Registration' );
$mail->setSender( 'registerezsite@ez.no' );
$mail->setSubject( $subject );
$mail->setBody( $bodyText );
$mailResult = eZMailTransport::send( $mail );
$this->PersistenceList['email_info']['result'] = $mailResult;
}
else
{
$this->PersistenceList['email_info']['result'] = false;
}
return true;
}
else
{
return false;
}
}
return false; // Always display registration information
}
示例8: testSSLSending
public function testSSLSending()
{
// test SSL
$ini = eZINI::instance('test_ezmail_ssl.ini');
$mailSetting = $ini->group('MailSettings');
//if SSL information is not set, skip this test
if (!$mailSetting['TransportServer']) {
return;
}
$siteINI = eZINI::instance();
$backupSetting = $siteINI->group('MailSettings');
$siteINI->setVariables(array('MailSettings' => $mailSetting));
$mail = new eZMail();
$mail->setReceiver($mailSetting['TransportUser'], 'TEST RECEIVER');
$mail->setSender($mailSetting['TransportUser'], 'TEST SENDER');
$mail->setSubject('SSL EMAIL TESTING');
$mail->setBody('This is a mail testing. TEST SSL in ' . __METHOD__);
$result = eZMailTransport::send($mail);
$this->assertTrue($result);
$siteINI->setVariables(array('MailSettings' => $backupSetting));
//todo: delete the received mails in teardown.
}
示例9: eZMail
$ini = eZINI::instance();
$mail = new eZMail();
if ($tpl->hasVariable('content_type')) {
$mail->setContentType($tpl->variable('content_type'));
}
if (!$mail->validate($receiver)) {
$receiver = $ini->variable("InformationCollectionSettings", "EmailReceiver");
if (!$receiver) {
$receiver = $ini->variable("MailSettings", "AdminEmail");
}
}
$mail->setReceiver($receiver);
if (!$mail->validate($sender)) {
$sender = $ini->variable("MailSettings", "EmailSender");
}
$mail->setSender($sender);
if (!$mail->validate($replyTo)) {
// If replyTo address is not set in the template, take it from the settings
$replyTo = $ini->variable("MailSettings", "EmailReplyTo");
if (!$mail->validate($replyTo)) {
// If replyTo address is not set in the settings, use the sender address
$replyTo = $sender;
}
}
$mail->setReplyTo($replyTo);
// Handle CC recipients
if ($ccReceivers) {
if (!is_array($ccReceivers)) {
$ccReceivers = array($ccReceivers);
}
foreach ($ccReceivers as $ccReceiver) {
示例10: get
//.........这里部分代码省略.........
$r = ldap_bind($ds, $LDAPBindUser, $LDAPBindPassword);
}
if ($r) {
$ok = 1;
}
// added: release resources, be ready for next test
ldap_close($ds);
}
} else {
$ok = -1;
}
return array('oid' => $oid, 'type' => eZSNMPd::TYPE_INTEGER, 'value' => $ok);
case '2.4.2':
// web connection
$ini = eZINI::instance('snmpd.ini');
$websites = $ini->variable('StatusHandler', 'WebBeacons');
$ok = 0;
if (is_string($websites)) {
$websites = array($websites);
}
foreach ($websites as $key => $site) {
if (trim($site) == '') {
unset($websites[$key]);
}
}
if (count($websites)) {
foreach ($websites as $site) {
// current eZ code is broken if no curl is installed, as it does not check for 404 or such.
// besides, it does not even support proxies...
if (extension_loaded('curl')) {
if (eZHTTPTool::getDataByURL($site, true)) {
$ok = 1;
break;
}
} else {
$data = eZHTTPTool::getDataByURL($site, false);
if ($data !== false && sysInfoTools::isHTTP200($data)) {
$ok = 1;
break;
}
}
}
} else {
$ok = -1;
}
return array('oid' => $oid, 'type' => eZSNMPd::TYPE_INTEGER, 'value' => $ok);
case '2.4.3':
// email connection
$ini = eZINI::instance('snmpd.ini');
$recipient = $ini->variable('StatusHandler', 'MailReceiver');
$ok = 0;
$mail = new eZMail();
if (trim($recipient) != '' && $mail->validate($recipient)) {
$mail->setReceiver($recipient);
$ini = eZINI::instance();
$sender = $ini->variable('MailSettings', 'EmailSender');
$mail->setSender($sender);
$mail->setSubject("Test email");
$mail->setBody("This email was automatically sent while testing eZ Publish connectivity to the mail server. Please do not reply.");
$mailResult = eZMailTransport::send($mail);
if ($mailResult) {
$ok = 1;
}
} else {
$ok = -1;
}
return array('oid' => $oid, 'type' => eZSNMPd::TYPE_INTEGER, 'value' => $ok);
case '2.5.1':
$fileINI = eZINI::instance('file.ini');
$clusterhandler = $fileINI->variable('ClusteringSettings', 'FileHandler');
if ($clusterhandler == 'ezdb' || $clusterhandler == 'eZDBFileHandler') {
$ok = 0;
$dbFileHandler = eZClusterFileHandler::instance();
if ($dbFileHandler instanceof eZDBFileHandler) {
// warning - we dig into the private parts of the cluster file handler,
// as no real API are provided for it (yet)
if (is_resource($dbFileHandler->backend->db)) {
$ok = 1;
}
}
} else {
if ($clusterhandler == 'eZDFSFileHandler') {
// This is even worse: we have no right to know if db connection is ok.
// So we replicate some code here...
$dbbackend = eZExtension::getHandlerClass(new ezpExtensionOptions(array('iniFile' => 'file.ini', 'iniSection' => 'eZDFSClusteringSettings', 'iniVariable' => 'DBBackend')));
try {
$dbbackend->_connect();
$ok = 1;
} catch (exception $e) {
$ok = 0;
}
} else {
$ok = -1;
}
}
return array('oid' => $oid, 'type' => eZSNMPd::TYPE_INTEGER, 'value' => $ok);
}
return self::NO_SUCH_OID;
// oid not managed
}
示例11: checkContentActions
//.........这里部分代码省略.........
if ($ini->hasGroup('VerifyUserType_' . $verifyUserType)) {
if ($ini->hasVariable('VerifyUserType_' . $verifyUserType, 'File')) {
include_once $ini->variable('VerifyUserType_' . $verifyUserType, 'File');
}
$verifyUserTypeClass = $ini->variable('VerifyUserType_' . $verifyUserType, 'Class');
}
// try to call the verify user class with function verifyUser
if ($verifyUserTypeClass && method_exists($verifyUserTypeClass, 'verifyUser')) {
$sendUserMail = call_user_func(array($verifyUserTypeClass, 'verifyUser'), $user, $tpl);
} else {
eZDebug::writeWarning("Unknown VerifyUserType '{$verifyUserType}'", 'user/register');
}
}
}
// send verification mail to user if email type or custum verify user type returned true
if ($sendUserMail) {
$templateResult = $tpl->fetch('design:user/registrationinfo.tpl');
if ($tpl->hasVariable('content_type')) {
$mail->setContentType($tpl->variable('content_type'));
}
$emailSender = $ini->variable('MailSettings', 'EmailSender');
if ($tpl->hasVariable('email_sender')) {
$emailSender = $tpl->variable('email_sender');
} else {
if (!$emailSender) {
$emailSender = $ini->variable('MailSettings', 'AdminEmail');
}
}
if ($tpl->hasVariable('subject')) {
$subject = $tpl->variable('subject');
} else {
$subject = ezpI18n::tr('kernel/user/register', 'Registration info');
}
$mail->setSender($emailSender);
$mail->setReceiver($receiver);
$mail->setSubject($subject);
$mail->setBody($templateResult);
$mailResult = eZMailTransport::send($mail);
}
$feedbackTypes = $ini->variableArray('UserSettings', 'RegistrationFeedback');
foreach ($feedbackTypes as $feedbackType) {
switch ($feedbackType) {
case 'email':
// send feedback with the default email type
$mail = new eZMail();
$tpl->resetVariables();
$tpl->setVariable('user', $user);
$tpl->setVariable('object', $object);
$tpl->setVariable('hostname', $hostname);
$templateResult = $tpl->fetch('design:user/registrationfeedback.tpl');
if ($tpl->hasVariable('content_type')) {
$mail->setContentType($tpl->variable('content_type'));
}
$emailSender = $ini->variable('MailSettings', 'EmailSender');
if ($tpl->hasVariable('email_sender')) {
$emailSender = $tpl->variable('email_sender');
} else {
if (!$emailSender) {
$emailSender = $ini->variable('MailSettings', 'AdminEmail');
}
}
$feedbackReceiver = $ini->variable('UserSettings', 'RegistrationEmail');
if ($tpl->hasVariable('email_receiver')) {
$feedbackReceiver = $tpl->variable('email_receiver');
} else {
if (!$feedbackReceiver) {
示例12: sendMail
/**
* Sends an email and logs all data, with send result, to previously specified log file.
*
* @return bool
*/
public function sendMail()
{
$this->logger->log(str_pad('', 77, '*'), ezcLog::INFO);
$this->logger->log("[Subject] " . $this->subject, ezcLog::INFO);
$this->logger->log("[From email] " . $this->sender, ezcLog::INFO);
$this->logger->log("[To email] " . implode(", ", $this->recipients), ezcLog::INFO);
$this->logger->log("[Message] " . $this->message, ezcLog::INFO);
if (!$this->canBeSend()) {
$this->logger->log("[Send status] " . 0 . "\nImproper email data.", ezcLog::INFO);
return false;
}
$email = new eZMail();
$email->setSubject($this->subject);
$email->setSender($this->sender);
foreach ( $this->recipients as $recipient) {
$email->addReceiver($recipient);
}
$email->setBody($this->message);
$email->setContentType('text/plain', 'UTF-8');
$sendStatus = eZMailTransport::send($email);
$this->logger->log("[Send status] " . $sendStatus, ezcLog::INFO);
return $sendStatus;
}
示例13: testRegressionWrongPasswordCatchException
public function testRegressionWrongPasswordCatchException()
{
ezpINIHelper::setINISetting('site.ini', 'MailSettings', 'TransportPassword', 'wrong password');
$mail = new eZMail();
$mail->setSender($this->adminEmail, $this->adminName);
$mail->setReceiver($this->adminEmail, $this->adminName);
$mail->setSubject(__FUNCTION__);
$mail->setBody(__FUNCTION__);
// catching the exception of wrong password and turning it into return false
$this->assertEquals(false, eZMailTransport::send($mail));
}
示例14: array
}
if ($fromEmail == null) {
$fromEmail = $yourEmail;
}
if ($http->hasSessionVariable('ezpContentTipafriendList')) {
if (strpos($http->sessionVariable('ezpContentTipafriendList'), $NodeID . '|' . $receiversEmail) !== false) {
$error_strings[] = ezpI18n::tr('kernel/content', "You have already sent a tipafriend mail to this receiver regarding '%1' content", null, array($nodeName));
}
}
if (!isset($error_strings[0]) && !eZTipafriendRequest::checkReceiver($receiversEmail)) {
$error_strings[] = ezpI18n::tr('kernel/content', 'The receiver has already received the maximum number of tipafriend mails the last hours');
}
// no validation errors
if (count($error_strings) == 0) {
$mail = new eZMail();
$mail->setSender($fromEmail, $yourName);
$mail->setReceiver($receiversEmail, $receiversName);
$mail->setSubject($subject);
// fetch
$sectionID = $object->attribute('section_id');
$section = eZSection::fetch($sectionID);
$res = eZTemplateDesignResource::instance();
$res->setKeys(array(array('object', $object->attribute('id')), array('remote_id', $object->attribute('remote_id')), array('node_remote_id', $node->attribute('remote_id')), array('class', $object->attribute('contentclass_id')), array('class_identifier', $object->attribute('class_identifier')), array('class_group', $object->attribute('match_ingroup_id_list')), array('section', $object->attribute('section_id')), array('section_identifier', $section->attribute('identifier')), array('node', $NodeID), array('parent_node', $node->attribute('parent_node_id')), array('depth', $node->attribute('depth')), array('url_alias', $node->attribute('url_alias'))));
$overrideKeysAreSet = true;
// fetch text from mail template
$mailtpl = eZTemplate::factory();
$mailtpl->setVariable('hostname', $hostName);
$mailtpl->setVariable('nodename', $nodeName);
$mailtpl->setVariable('node_id', $NodeID);
$mailtpl->setVariable('node', $node);
$mailtpl->setVariable('your_name', $yourName);
示例15: sendConfirmation
function sendConfirmation($email, $subscription, $subscribe)
{
//send mail
$res = eZTemplateDesignResource::instance();
$ini = eZINI::instance();
$hostname = eZSys::hostname();
if ($subscribe) {
$template = 'design:eznewsletter/sendout/subscription.tpl';
} else {
$template = 'design:eznewsletter/sendout/unsubscription.tpl';
}
$tpl = eZNewsletterTemplateWrapper::templateInit();
$tpl->setVariable('userData', eZUserSubscriptionData::fetch($email));
$tpl->setVariable('hostname', $hostname);
$tpl->setVariable('subscription', $subscription);
$subscriptionList = eZSubscriptionList::fetch($subscription->attribute('subscriptionlist_id'), eZSubscriptionList::StatusPublished, true, true);
$tpl->setVariable('subscriptionList', $subscriptionList);
$templateResult = $tpl->fetch($template);
if ($tpl->hasVariable('subject')) {
$subject = $tpl->variable('subject');
}
$mail = new eZMail();
$mail->setSender($ini->variable('MailSettings', 'EmailSender'));
$mail->setReceiver($email);
$mail->setBody($templateResult);
$mail->setSubject($subject);
eZMailTransport::send($mail);
}