本文整理汇总了PHP中eZMail类的典型用法代码示例。如果您正苦于以下问题:PHP eZMail类的具体用法?PHP eZMail怎么用?PHP eZMail使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了eZMail类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: sendMail
function sendMail(eZMail $mail)
{
$ini = eZINI::instance();
$parameters = array();
$parameters['host'] = $ini->variable('MailSettings', 'TransportServer');
$parameters['helo'] = $ini->variable('MailSettings', 'SenderHost');
$parameters['port'] = $ini->variable('MailSettings', 'TransportPort');
$parameters['connectionType'] = $ini->variable('MailSettings', 'TransportConnectionType');
$user = $ini->variable('MailSettings', 'TransportUser');
$password = $ini->variable('MailSettings', 'TransportPassword');
if ($user and $password) {
$parameters['auth'] = true;
$parameters['user'] = $user;
$parameters['pass'] = $password;
}
/* If email sender hasn't been specified or is empty
* we substitute it with either MailSettings.EmailSender or AdminEmail.
*/
if (!$mail->senderText()) {
$emailSender = $ini->variable('MailSettings', 'EmailSender');
if (!$emailSender) {
$emailSender = $ini->variable('MailSettings', 'AdminEmail');
}
eZMail::extractEmail($emailSender, $emailSenderAddress, $emailSenderName);
if (!eZMail::validate($emailSenderAddress)) {
$emailSender = false;
}
if ($emailSender) {
$mail->setSenderText($emailSender);
}
}
$excludeHeaders = $ini->variable('MailSettings', 'ExcludeHeaders');
if (count($excludeHeaders) > 0) {
$mail->Mail->appendExcludeHeaders($excludeHeaders);
}
$options = new ezcMailSmtpTransportOptions();
if ($parameters['connectionType']) {
$options->connectionType = $parameters['connectionType'];
}
$smtp = new ezcMailSmtpTransport($parameters['host'], $user, $password, $parameters['port'], $options);
// If in debug mode, send to debug email address and nothing else
if ($ini->variable('MailSettings', 'DebugSending') == 'enabled') {
$mail->Mail->to = array(new ezcMailAddress($ini->variable('MailSettings', 'DebugReceiverEmail')));
$mail->Mail->cc = array();
$mail->Mail->bcc = array();
}
// send() from ezcMailSmtpTransport doesn't return anything (it uses exceptions in case
// something goes bad)
try {
eZPerfLogger::accumulatorStart('mail_sent');
$smtp->send($mail->Mail);
eZPerfLogger::accumulatorStop('mail_sent');
} catch (ezcMailException $e) {
eZPerfLogger::accumulatorStop('mail_send');
eZDebug::writeError($e->getMessage(), __METHOD__);
return false;
}
// return true in case of no exceptions
return true;
}
开发者ID:gggeek,项目名称:ezperformancelogger,代码行数:60,代码来源:ezsmtptracingtransport.php
示例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);
}
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:25,代码来源:ezsubscription.php
示例3: sendMail
function sendMail(eZMail $mail)
{
$ini = eZINI::instance();
$sendmailOptions = '';
$emailFrom = $mail->sender();
$emailSender = isset($emailFrom['email']) ? $emailFrom['email'] : false;
if (!$emailSender || count($emailSender) <= 0) {
$emailSender = $ini->variable('MailSettings', 'EmailSender');
}
if (!$emailSender) {
$emailSender = $ini->variable('MailSettings', 'AdminEmail');
}
if (!eZMail::validate($emailSender)) {
$emailSender = false;
}
$isSafeMode = ini_get('safe_mode') != 0;
$sendmailOptionsArray = $ini->variable('MailSettings', 'SendmailOptions');
if (is_array($sendmailOptionsArray)) {
$sendmailOptions = implode(' ', $sendmailOptionsArray);
} elseif (!is_string($sendmailOptionsArray)) {
$sendmailOptions = $sendmailOptionsArray;
}
if (!$isSafeMode and $emailSender) {
$sendmailOptions .= ' -f' . $emailSender;
}
if ($isSafeMode and $emailSender and $mail->sender() == false) {
$mail->setSenderText($emailSender);
}
if (function_exists('mail')) {
$message = $mail->body();
$sys = eZSys::instance();
$excludeHeaders = array('Subject');
// If not Windows PHP mail() implementation, we can not specify a To: header in the $additional_headers parameter,
// because then there will be 2 To: headers in the resulting e-mail.
// However, we can use "undisclosed-recipients:;" in $to.
if ($sys->osType() != 'win32') {
$excludeHeaders[] = 'To';
$receiverEmailText = count($mail->ReceiverElements) > 0 ? $mail->receiverEmailText() : 'undisclosed-recipients:;';
} else {
$receiverEmailText = $mail->receiverEmailText();
}
// If in debug mode, send to debug email address and nothing else
if ($ini->variable('MailSettings', 'DebugSending') == 'enabled') {
$receiverEmailText = $ini->variable('MailSettings', 'DebugReceiverEmail');
$excludeHeaders[] = 'To';
$excludeHeaders[] = 'Cc';
$excludeHeaders[] = 'Bcc';
}
$extraHeaders = $mail->headerText(array('exclude-headers' => $excludeHeaders));
$returnedValue = mail($receiverEmailText, $mail->subject(), $message, $extraHeaders, $sendmailOptions);
if ($returnedValue === false) {
eZDebug::writeError('An error occurred while sending e-mail. Check the Sendmail error message for further information (usually in /var/log/messages)', __METHOD__);
}
return $returnedValue;
} else {
eZDebug::writeWarning("Unable to send mail: 'mail' function is not compiled into PHP.", __METHOD__);
}
return false;
}
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:59,代码来源:ezsendmailtransport.php
示例4: validateEMailHTTPInput
function validateEMailHTTPInput($email, $contentObjectAttribute)
{
if (!eZMail::validate($email)) {
$contentObjectAttribute->setValidationError(ezpI18n::tr('kernel/classes/datatypes', 'The email address is not valid.'));
return eZInputValidator::STATE_INVALID;
}
return eZInputValidator::STATE_ACCEPTED;
}
开发者ID:patrickallaert,项目名称:ezpublish-legacy-php7,代码行数:8,代码来源:ezemailtype.php
示例5: 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);
}
}
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:35,代码来源:ezdefaultconfirmorderhandler.php
示例6: validateObjectAttributeHTTPInput
function validateObjectAttributeHTTPInput($http, $base, $contentObjectAttribute)
{
$actionRemoveSelected = false;
if ($http->hasPostVariable('CustomActionButton')) {
$customActionArray = $http->postVariable('CustomActionButton');
if (isset($customActionArray[$contentObjectAttribute->attribute("id") . '_remove_selected'])) {
if ($customActionArray[$contentObjectAttribute->attribute("id") . '_remove_selected'] == 'Remove selected') {
$actionRemoveSelected = true;
}
}
}
if ($http->hasPostVariable($base . "_data_author_id_" . $contentObjectAttribute->attribute("id"))) {
$classAttribute = $contentObjectAttribute->contentClassAttribute();
$idList = $http->postVariable($base . "_data_author_id_" . $contentObjectAttribute->attribute("id"));
$nameList = $http->postVariable($base . "_data_author_name_" . $contentObjectAttribute->attribute("id"));
$emailList = $http->postVariable($base . "_data_author_email_" . $contentObjectAttribute->attribute("id"));
if ($http->hasPostVariable($base . "_data_author_remove_" . $contentObjectAttribute->attribute("id"))) {
$removeList = $http->postVariable($base . "_data_author_remove_" . $contentObjectAttribute->attribute("id"));
} else {
$removeList = array();
}
if ($contentObjectAttribute->validateIsRequired()) {
if (trim($nameList[0]) == "") {
$contentObjectAttribute->setValidationError(ezpI18n::tr('kernel/classes/datatypes', 'At least one author is required.'));
return eZInputValidator::STATE_INVALID;
}
}
if (trim($nameList[0]) != "") {
for ($i = 0; $i < count($idList); $i++) {
if ($actionRemoveSelected) {
if (in_array($idList[$i], $removeList)) {
continue;
}
}
$name = $nameList[$i];
$email = $emailList[$i];
if (trim($name) == "") {
$contentObjectAttribute->setValidationError(ezpI18n::tr('kernel/classes/datatypes', 'The author name must be provided.'));
return eZInputValidator::STATE_INVALID;
}
$isValidate = eZMail::validate($email);
if (!$isValidate) {
$contentObjectAttribute->setValidationError(ezpI18n::tr('kernel/classes/datatypes', 'The email address is not valid.'));
return eZInputValidator::STATE_INVALID;
}
}
}
} else {
if ($contentObjectAttribute->validateIsRequired()) {
$contentObjectAttribute->setValidationError(ezpI18n::tr('kernel/classes/datatypes', 'At least one author is required.'));
return eZInputValidator::STATE_INVALID;
}
}
return eZInputValidator::STATE_ACCEPTED;
}
开发者ID:patrickallaert,项目名称:ezpublish-legacy-php7,代码行数:55,代码来源:ezauthortype.php
示例7: sendMail
function sendMail(eZMail $mail)
{
$ini = eZINI::instance();
$sendmailOptions = '';
$emailFrom = $mail->sender();
$emailSender = $emailFrom['email'];
if (!$emailSender || count($emailSender) <= 0) {
$emailSender = $ini->variable('MailSettings', 'EmailSender');
}
if (!$emailSender) {
$emailSender = $ini->variable('MailSettings', 'AdminEmail');
}
if (!eZMail::validate($emailSender)) {
$emailSender = false;
}
$isSafeMode = ini_get('safe_mode');
if ($isSafeMode and $emailSender and $mail->sender() == false) {
$mail->setSenderText($emailSender);
}
$filename = time() . '-' . mt_rand() . '.mail';
$data = preg_replace('/(\\r\\n|\\r|\\n)/', "\r\n", $mail->headerText() . "\n" . $mail->body());
$returnedValue = eZFile::create($filename, 'var/log/mail', $data);
if ($returnedValue === false) {
eZDebug::writeError('An error occurred writing the e-mail file in var/log/mail', __METHOD__);
}
return $returnedValue;
}
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:27,代码来源:ezfiletransport.php
示例8: validateObjectAttributeHTTPInput
function validateObjectAttributeHTTPInput($http, $base, $contentObjectAttribute)
{
//$classAttribute = $contentObjectAttribute->contentClassAttribute();
if ($http->hasPostVariable($base . '_data_text_' . $contentObjectAttribute->attribute('id'))) {
$email = $http->postVariable($base . '_data_text_' . $contentObjectAttribute->attribute('id'));
$trimmedEmail = trim($email);
if ($trimmedEmail == "") {
return eZInputValidator::STATE_ACCEPTED;
}
if (!eZMail::validate($trimmedEmail)) {
$contentObjectAttribute->setValidationError(ezi18n('kernel/classes/datatypes', 'The email address is not valid.'));
return eZInputValidator::STATE_INVALID;
}
}
return eZInputValidator::STATE_ACCEPTED;
}
开发者ID:jjohnsen,项目名称:jajnewsletter,代码行数:16,代码来源:jajpreviewnewslettertype.php
示例9: processPostData
function processPostData()
{
$user = array();
$user['first_name'] = $this->Http->postVariable( 'eZSetup_site_templates_first_name' );
$user['last_name'] = $this->Http->postVariable( 'eZSetup_site_templates_last_name' );
$user['email'] = $this->Http->postVariable( 'eZSetup_site_templates_email' );
if ( strlen( trim( $user['first_name'] ) ) == 0 )
{
$this->Error[] = self::FIRST_NAME_MISSING;
}
if ( strlen( trim( $user['last_name'] ) ) == 0 )
{
$this->Error[] = self::LAST_NAME_MISSING;
}
if ( strlen( trim( $user['email'] ) ) == 0 )
{
$this->Error[] = self::EMAIL_MISSING;
}
else if ( !eZMail::validate( trim( $user['email'] ) ) )
{
$this->Error[] = self::EMAIL_INVALID;
}
if ( strlen( trim( $this->Http->postVariable( 'eZSetup_site_templates_password1' ) ) ) == 0 )
{
$this->Error[] = self::PASSWORD_MISSING;
}
else if ( $this->Http->postVariable( 'eZSetup_site_templates_password1' ) != $this->Http->postVariable( 'eZSetup_site_templates_password2' ) )
{
$this->Error[] = self::PASSWORD_MISSMATCH;
}
else if ( !eZUser::validatePassword( trim( $this->Http->postVariable( 'eZSetup_site_templates_password1' ) ) ) )
{
$this->Error[] = self::PASSWORD_TOO_SHORT;
}
else
{
$user['password'] = $this->Http->postVariable( 'eZSetup_site_templates_password1' );
}
if ( !isset( $user['password'] ) )
$user['password'] = '';
$this->PersistenceList['admin'] = $user;
return ( count( $this->Error ) == 0 );
}
开发者ID:robinmuilwijk,项目名称:ezpublish,代码行数:45,代码来源:ezstep_site_admin.php
示例10: processViewActions
function processViewActions(&$validation, $params)
{
$http = eZHTTPTool::instance();
$prefix = eZSurveyType::PREFIX_ATTRIBUTE;
$attributeID = $params['contentobjectattribute_id'];
$postAnswer = $prefix . '_ezsurvey_answer_' . $this->ID . '_' . $attributeID;
$answer = trim($http->postVariable($postAnswer));
if ($this->attribute('mandatory') == 1 and strlen($answer) == 0) {
$validation['error'] = true;
$validation['errors'][] = array('message' => ezpI18n::tr('survey', 'Please answer the question %number as well!', null, array('%number' => $this->questionNumber())), 'question_number' => $this->questionNumber(), 'code' => 'email_answer_question', 'question' => $this);
} else {
if (strlen($answer) != 0 && !eZMail::validate($answer)) {
$validation['error'] = true;
$validation['errors'][] = array('message' => ezpI18n::tr('survey', 'Entered text in the question %number is not a valid email address!', null, array('%number' => $this->questionNumber())), 'question_number' => $this->questionNumber(), 'code' => 'email_email_not_valid', 'question' => $this);
}
}
$this->setAnswer($answer);
}
开发者ID:netbliss,项目名称:ezsurvey,代码行数:18,代码来源:ezsurveyemailentry.php
示例11: 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;
}
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:44,代码来源:ezsendmail.php
示例12: validateField
/**
* Implement the validatation in adding comment
* @see extension/ezcomments/classes/ezcomFormTool#validateField($field)
*/
protected function validateField($field, $value)
{
switch ($field) {
case 'website':
return ezcomUtility::validateURLString($value);
case 'email':
// just validate anonymous's input email
$user = eZUser::currentUser();
if ($user->isAnonymous()) {
$result = eZMail::validate($value);
if (!$result) {
return ezpI18n::tr('ezcomments/comment/add', 'Not a valid email address.');
}
}
return true;
case 'recaptcha':
require_once 'recaptchalib.php';
$ini = eZINI::instance('ezcomments.ini');
$privateKey = $ini->variable('RecaptchaSetting', 'PrivateKey');
$http = eZHTTPTool::instance();
if ($http->hasPostVariable('recaptcha_challenge_field') && $http->hasPostVariable('recaptcha_response_field')) {
$ip = $_SERVER["REMOTE_ADDR"];
$challengeField = $http->postVariable('recaptcha_challenge_field');
$responseField = $http->postVariable('recaptcha_response_field');
$capchaResponse = recaptcha_check_answer($privateKey, $ip, $challengeField, $responseField);
if (!$capchaResponse->is_valid) {
return ezpI18n::tr('ezcomments/comment/add', 'The words you input are incorrect.');
}
} else {
return ezpI18n::tr('ezcomments/comment/add', 'Captcha parameter error.');
}
return true;
default:
return true;
}
}
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:40,代码来源:ezcomaddcommenttool.php
示例13: publishHandlerLink
/**
* publishHandlerLink (Publish handler, pass 2 after schema validation)
* Publish handler for link element, converts href to [object|node|link]_id.
*
* @param DOMElement $element
* @param array $param parameters for xml element
* @return null|array changes structure if it contains 'result' key
*/
function publishHandlerLink($element, &$params)
{
$ret = null;
$href = $element->getAttribute('href');
if ($href) {
$objectID = false;
if (strpos($href, 'ezobject') === 0 && preg_match("@^ezobject://([0-9]+)/?(#.+)?@i", $href, $matches)) {
$objectID = $matches[1];
if (isset($matches[2])) {
$anchorName = substr($matches[2], 1);
}
$element->setAttribute('object_id', $objectID);
if (!eZContentObject::exists($objectID)) {
$this->Messages[] = ezpI18n::tr('design/standard/ezoe/handler', 'Object %1 does not exist.', false, array($objectID));
}
} elseif (strpos($href, 'eznode') === 0 && preg_match("@^eznode://([^#]+)(#.+)?@i", $href, $matches)) {
$nodePath = trim($matches[1], '/');
if (isset($matches[2])) {
$anchorName = substr($matches[2], 1);
}
if (is_numeric($nodePath)) {
$nodeID = $nodePath;
$node = eZContentObjectTreeNode::fetch($nodeID);
if (!$node instanceof eZContentObjectTreeNode) {
$this->Messages[] = ezpI18n::tr('design/standard/ezoe/handler', 'Node %1 does not exist.', false, array($nodeID));
}
} else {
$node = eZContentObjectTreeNode::fetchByURLPath($nodePath);
if (!$node instanceof eZContentObjectTreeNode) {
$this->Messages[] = ezpI18n::tr('design/standard/ezoe/handler', 'Node '%1' does not exist.', false, array($nodePath));
} else {
$nodeID = $node->attribute('node_id');
}
$element->setAttribute('show_path', 'true');
}
if (isset($nodeID) && $nodeID) {
$element->setAttribute('node_id', $nodeID);
}
if (isset($node) && $node instanceof eZContentObjectTreeNode) {
$objectID = $node->attribute('contentobject_id');
}
} elseif (strpos($href, '#') === 0) {
$anchorName = substr($href, 1);
} else {
$temp = explode('#', $href);
$url = $temp[0];
if (isset($temp[1])) {
$anchorName = $temp[1];
}
if ($url) {
// Protection from XSS attack
if (preg_match("/^(java|vb)script:.*/i", $url)) {
$this->isInputValid = false;
$this->Messages[] = "Using scripts in links is not allowed, '{$url}' has been removed";
$element->removeAttribute('href');
return $ret;
}
// Check mail address validity following RFC 5322 and RFC 5321
if (preg_match("/^mailto:([^.][a-z0-9!#\$%&'*+-\\/=?`{|}~^]+@([a-z0-9.-]+))/i", $url, $mailAddr)) {
if (!eZMail::validate($mailAddr[1])) {
$this->isInputValid = false;
if ($this->errorLevel >= 0) {
$this->Messages[] = ezpI18n::tr('kernel/classes/datatypes/ezxmltext', "Invalid e-mail address: '%1'", false, array($mailAddr[1]));
}
$element->removeAttribute('href');
return $ret;
}
}
// Store urlID instead of href
$url = str_replace(array('&', '%28', '%29'), array('&', '(', ')'), $url);
$urlID = eZURL::registerURL($url);
if ($urlID) {
if (!in_array($urlID, $this->urlIDArray)) {
$this->urlIDArray[] = $urlID;
}
$element->setAttribute('url_id', $urlID);
}
}
}
if ($objectID && !in_array($objectID, $this->linkedObjectIDArray)) {
$this->linkedObjectIDArray[] = $objectID;
}
if (isset($anchorName) && $anchorName) {
$element->setAttribute('anchor_name', $anchorName);
}
}
return $ret;
}
开发者ID:legende91,项目名称:ez,代码行数:96,代码来源:ezoeinputparser.php
示例14: executeBeforeLastRedirect
public function executeBeforeLastRedirect($node)
{
$survey = $this->fetchFeedbackSurvey();
$surveyQuestions = $this->feedbackQuestionList();
$mailTo = $this->fetchMailTo($surveyQuestions);
if ($survey = $this->fetchFeedbackSurvey() and $survey instanceof eZSurvey and $surveyQuestions = $this->feedbackQuestionList() and $mailTo = $this->fetchMailTo($surveyQuestions) and eZMail::validate($mailTo)) {
$tpl_email = eZTemplate::factory();
$tpl_email->setVariable('intro', $this->Text2);
$tpl_email->setVariable('survey', $survey);
$tpl_email->setVariable('survey_questions', $surveyQuestions);
$tpl_email->setVariable('survey_node', $node);
$templateResult = $tpl_email->fetch('design:survey/feedbackfield_mail.tpl');
if (trim($this->Text3) != '') {
$subject = $this->Text3;
} else {
$subject = $tpl_email->variable('subject');
}
$mail = new eZMail();
$ini = eZINI::instance();
$emailSender = $ini->variable('MailSettings', 'EmailSender');
if (!$emailSender) {
$emailSender = $ini->variable('MailSettings', 'AdminEmail');
}
$mail->setSenderText($emailSender);
$mail->setReceiver($mailTo);
$mail->setSubject($subject);
$mail->setBody($templateResult);
if ($this->Num == 1) {
$adminReceiver = $ini->variable('MailSettings', 'AdminEmail');
$mail->addBcc($adminReceiver);
}
$mailResult = eZMailTransport::send($mail);
}
}
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:34,代码来源:ezsurveyfeedbackfield.php
示例15: array
$modifierDays = $http->hasPostVariable('SendModifierDays') ? $http->postVariable('SendModifierDays') : 0;
$modifierHours = $http->hasPostVariable('SendModifierHours') ? $http->postVariable('SendModifierHours') : 0;
$modifierMinutes = $http->hasPostVariable('SendModifierMinutes') ? $http->postVariable('SendModifierMinutes') : 0;
$SendDateModifier = $modifierDays * 86400 + $modifierHours * 3600 + $modifierMinutes * 60;
$newsletterType->setAttribute('send_date_modifier', $SendDateModifier);
$preText = $http->hasPostVariable('preText') ? $http->postVariable('preText') : '';
$postText = $http->hasPostVariable('postText') ? $http->postVariable('postText') : '';
$newsletterType->setAttribute('pretext', $preText);
$newsletterType->setAttribute('posttext', $postText);
if ($http->postVariable('PersonaliseNewsletter')) {
$newsletterType->setAttribute('personalise', '1');
} else {
$newsletterType->setAttribute('personalise', '0');
}
$senderAddress = $http->postVariable('NewsletterTypeSenderAddress');
if (eZMail::validate($senderAddress)) {
$newsletterType->setAttribute('sender_address', $senderAddress);
} else {
$warning[] = ezpI18n::tr('eznewsletter/edit_newslettertype', 'Email address "%address" did not validate.', false, array('%address' => $senderAddress));
}
if ($http->hasPostVariable('ValidContentClassIDArray')) {
$newsletterType->setAttribute('contentclass_list', eZNewsletterType::serializeArray($http->postVariable('ValidContentClassIDArray')));
}
if ($http->hasPostVariable('AllowedDesigns') && 0 < count($http->postVariable('AllowedDesigns'))) {
$newsletterType->setAttribute('allowed_designs', eZNewsletterType::serializeArray($http->postVariable('AllowedDesigns')));
} else {
$warning[] = ezpI18n::tr('eznewsletter/edit_newslettertype', 'You have to select at least one design.');
}
if ($http->hasPostVariable('AllowedSiteaccesses') && 0 < count($http->postVariable('AllowedSiteaccesses'))) {
$newsletterType->setAttribute('allowed_siteaccesses', eZNewsletterType::serializeArray($http->postVariable('AllowedSiteaccesses')));
} else {
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:31,代码来源:edit_newslettertype.php
示例16: 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( '[email protected]', 'eZ Site Registration' );
$mail->setSender( '[email protected]' );
$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
}
开发者ID:nottavi,项目名称:ezpublish,代码行数:44,代码来源:ezstep_registration.php
示例17: validateUserInput
/**
* Validates input from user registration form
*
* @param eZHTTPTool $http
*
* @return array
*/
public static function validateUserInput($http)
{
if ($http->hasPostVariable('data_user_login') && $http->hasPostVariable('data_user_email') && $http->hasPostVariable('data_user_password') && $http->hasPostVariable('data_user_password_confirm')) {
$loginName = $http->postVariable('data_user_login');
$email = $http->postVariable('data_user_email');
$password = $http->postVariable('data_user_password');
$passwordConfirm = $http->postVariable('data_user_password_confirm');
if (trim($loginName) == '') {
return array('status' => 'error', 'message' => ezpI18n::tr('kernel/classes/datatypes', 'The username must be specified.'));
} else {
$existUser = eZUser::fetchByName($loginName);
if ($existUser != null) {
return array('status' => 'error', 'message' => ezpI18n::tr('kernel/classes/datatypes', 'The username already exists, please choose another one.'));
}
// validate user email
$isValidate = eZMail::validate($email);
if (!$isValidate) {
return array('status' => 'error', 'message' => ezpI18n::tr('kernel/classes/datatypes', 'The email address is not valid.'));
}
$authenticationMatch = eZUser::authenticationMatch();
if ($authenticationMatch & eZUser::AUTHENTICATE_EMAIL) {
if (eZUser::requireUniqueEmail()) {
$userByEmail = eZUser::fetchByEmail($email);
if ($userByEmail != null) {
return array('status' => 'error', 'message' => ezpI18n::tr('kernel/classes/datatypes', 'A user with this email already exists.'));
}
}
}
// validate user name
if (!eZUser::validateLoginName($loginName, $errorText)) {
return array('status' => 'error', 'message' => ezpI18n::tr('kernel/classes/datatypes', $errorText));
}
// validate user password
$ini = eZINI::instance();
$generatePasswordIfEmpty = $ini->variable("UserSettings", "GeneratePasswordIfEmpty") == 'true';
if (!$generatePasswordIfEmpty || $password != "") {
if ($password == "") {
return array('status' => 'error', 'message' => ezpI18n::tr('kernel/classes/datatypes', 'The password cannot be empty.', 'eZUserType'));
}
if ($password != $passwordConfirm) {
return array('status' => 'error', 'message' => ezpI18n::tr('kernel/classes/datatypes', 'The passwords do not match.', 'eZUserType'));
}
if (!eZUser::validatePassword($password)) {
$minPasswordLength = $ini->hasVariable('UserSettings', 'MinPasswordLength') ? $ini->variable('UserSettings', 'MinPasswordLength') : 3;
return array('status' => 'error', 'message' => ezpI18n::tr('kernel/classes/datatypes', 'The password must be at least %1 characters long.', null, array($minPasswordLength)));
}
if (strtolower($password) == 'password') {
return array('status' => 'error', 'message' => ezpI18n::tr('kernel/classes/datatypes', 'The password must not be "password".'));
}
}
}
} else {
return array('status' => 'error', 'message' => ezpI18n::tr('kernel/classes/datatypes', 'Input required.'));
}
return array('status' => 'success');
}
开发者ID:netgen,项目名称:ngconnect,代码行数:63,代码来源:ngconnectuseractivation.php
示例18: eZMail
$tpl->setVariable('viewmode', $ViewMode);
$tpl->setVariable('view_parameters', $userParameters);
$tpl->setVariable('object', $object);
$tpl->setVariable('attribute_hide_list', $attributeHideList);
$tpl->setVariable('collection', $collection);
$tpl->setVariable('object', $object);
$templateResult = $tpl->fetch('design:content/collectedinfomail/' . $informationCollectionTemplate . '.tpl');
$subject = $tpl->variable('subject');
$receiver = $tpl->variable('email_receiver');
$ccReceivers = $tpl->variable('email_cc_receivers');
$bccReceivers = $tpl->variable('email_bcc_receivers');
$sender = $tpl->variable('email_sender');
$replyTo = $tpl->variable('email_reply_to');
$redirectToNodeID = $tpl->variable('redirect_to_node_id');
$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)) {
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:31,代码来源:collectinformation.php
示例19: 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);
}
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:37,代码来源:ezuseroperationcollection.php
|
请发表评论