当前位置: 首页>>代码示例>>PHP>>正文


PHP MailUtility::getSystemFromAddress方法代码示例

本文整理汇总了PHP中TYPO3\CMS\Core\Utility\MailUtility::getSystemFromAddress方法的典型用法代码示例。如果您正苦于以下问题:PHP MailUtility::getSystemFromAddress方法的具体用法?PHP MailUtility::getSystemFromAddress怎么用?PHP MailUtility::getSystemFromAddress使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TYPO3\CMS\Core\Utility\MailUtility的用法示例。


在下文中一共展示了MailUtility::getSystemFromAddress方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: injectConfigurationManager

 /**
  * @param \TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface $configurationManager
  * @return void
  */
 public function injectConfigurationManager(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface $configurationManager)
 {
     parent::injectConfigurationManager($configurationManager);
     $defaultSettings = array('dateFormat' => $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'], 'login' => array('page' => $this->getFrontendController()->id), 'passwordReset' => array('loginOnSuccess' => FALSE, 'mail' => array('from' => MailUtility::getSystemFromAddress(), 'subject' => 'Password reset request'), 'page' => $this->getFrontendController()->id, 'token' => array('lifetime' => 86400)));
     $settings = $defaultSettings;
     ArrayUtility::mergeRecursiveWithOverrule($settings, $this->settings, TRUE, FALSE);
     $this->settings = $settings;
 }
开发者ID:mjankiewicz,项目名称:hairu,代码行数:12,代码来源:AuthenticationController.php

示例2: initializeAction

 /**
  * Initialize all actions
  *
  * @return void
  */
 protected function initializeAction()
 {
     // Apply default settings
     $defaultSettings = array('dateFormat' => $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'], 'login' => array('page' => $this->getFrontendController()->id), 'passwordReset' => array('loginOnSuccess' => FALSE, 'mail' => array('from' => MailUtility::getSystemFromAddress(), 'subject' => 'Password reset request'), 'page' => $this->getFrontendController()->id, 'token' => array('lifetime' => 86400)));
     $settings = $defaultSettings;
     ArrayUtility::mergeRecursiveWithOverrule($settings, $this->settings, TRUE, FALSE);
     $this->settings = $settings;
     // Make global form data (as expected by the CMS core) available
     $formData = GeneralUtility::_GET();
     ArrayUtility::mergeRecursiveWithOverrule($formData, GeneralUtility::_POST());
     $this->request->setArgument('formData', $formData);
 }
开发者ID:pagemachine,项目名称:hairu,代码行数:17,代码来源:AuthenticationController.php

示例3: start

 /**
  * Start function
  * This class is able to generate a mail in formmail-style from the data in $V
  * Fields:
  *
  * [recipient]:			email-adress of the one to receive the mail. If array, then all values are expected to be recipients
  * [attachment]:		....
  *
  * [subject]:			The subject of the mail
  * [from_email]:		Sender email. If not set, [email] is used
  * [from_name]:			Sender name. If not set, [name] is used
  * [replyto_email]:		Reply-to email. If not set [from_email] is used
  * [replyto_name]:		Reply-to name. If not set [from_name] is used
  * [organisation]:		Organization (header)
  * [priority]:			Priority, 1-5, default 3
  * [html_enabled]:		If mail is sent as html
  * [use_base64]:		If set, base64 encoding will be used instead of quoted-printable
  *
  * @param array $valueList Contains values for the field names listed above (with slashes removed if from POST input)
  * @param boolean $base64 Whether to base64 encode the mail content
  * @return void
  * @todo Define visibility
  */
 public function start($valueList, $base64 = FALSE)
 {
     $this->mailMessage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Mail\\MailMessage');
     if ($GLOBALS['TSFE']->config['config']['formMailCharset']) {
         // Respect formMailCharset if it was set
         $this->characterSet = $GLOBALS['TSFE']->csConvObj->parse_charset($GLOBALS['TSFE']->config['config']['formMailCharset']);
     } elseif ($GLOBALS['TSFE']->metaCharset != $GLOBALS['TSFE']->renderCharset) {
         // Use metaCharset for mail if different from renderCharset
         $this->characterSet = $GLOBALS['TSFE']->metaCharset;
     } else {
         // Otherwise use renderCharset as default
         $this->characterSet = $GLOBALS['TSFE']->renderCharset;
     }
     if ($base64 || $valueList['use_base64']) {
         $this->encoding = 'base64';
     }
     if (isset($valueList['recipient'])) {
         // Convert form data from renderCharset to mail charset
         $this->subject = $valueList['subject'] ? $valueList['subject'] : 'Formmail on ' . \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('HTTP_HOST');
         $this->subject = $this->sanitizeHeaderString($this->subject);
         $this->fromName = $valueList['from_name'] ? $valueList['from_name'] : ($valueList['name'] ? $valueList['name'] : '');
         $this->fromName = $this->sanitizeHeaderString($this->fromName);
         $this->replyToName = $valueList['replyto_name'] ? $valueList['replyto_name'] : $this->fromName;
         $this->replyToName = $this->sanitizeHeaderString($this->replyToName);
         $this->organisation = $valueList['organisation'] ? $valueList['organisation'] : '';
         $this->organisation = $this->sanitizeHeaderString($this->organisation);
         $this->fromAddress = $valueList['from_email'] ? $valueList['from_email'] : ($valueList['email'] ? $valueList['email'] : '');
         if (!\TYPO3\CMS\Core\Utility\GeneralUtility::validEmail($this->fromAddress)) {
             $this->fromAddress = \TYPO3\CMS\Core\Utility\MailUtility::getSystemFromAddress();
             $this->fromName = \TYPO3\CMS\Core\Utility\MailUtility::getSystemFromName();
         }
         $this->replyToAddress = $valueList['replyto_email'] ? $valueList['replyto_email'] : $this->fromAddress;
         $this->priority = $valueList['priority'] ? \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($valueList['priority'], 1, 5) : 3;
         // Auto responder
         $this->autoRespondMessage = trim($valueList['auto_respond_msg']) && $this->fromAddress ? trim($valueList['auto_respond_msg']) : '';
         if ($this->autoRespondMessage !== '') {
             // Check if the value of the auto responder message has been modified with evil intentions
             $autoRespondChecksum = $valueList['auto_respond_checksum'];
             $correctHmacChecksum = \TYPO3\CMS\Core\Utility\GeneralUtility::hmac($this->autoRespondMessage);
             if ($autoRespondChecksum !== $correctHmacChecksum) {
                 \TYPO3\CMS\Core\Utility\GeneralUtility::sysLog('Possible misuse of t3lib_formmail auto respond method. Subject: ' . $valueList['subject'], 'Core', \TYPO3\CMS\Core\Utility\GeneralUtility::SYSLOG_SEVERITY_ERROR);
                 return;
             } else {
                 $this->autoRespondMessage = $this->sanitizeHeaderString($this->autoRespondMessage);
             }
         }
         $plainTextContent = '';
         $htmlContent = '<table border="0" cellpadding="2" cellspacing="2">';
         // Runs through $V and generates the mail
         if (is_array($valueList)) {
             foreach ($valueList as $key => $val) {
                 if (!\TYPO3\CMS\Core\Utility\GeneralUtility::inList($this->reserved_names, $key)) {
                     $space = strlen($val) > 60 ? LF : '';
                     $val = is_array($val) ? implode($val, LF) : $val;
                     // Convert form data from renderCharset to mail charset (HTML may use entities)
                     $plainTextValue = $val;
                     $HtmlValue = htmlspecialchars($val);
                     $plainTextContent .= strtoupper($key) . ':  ' . $space . $plainTextValue . LF . $space;
                     $htmlContent .= '<tr><td bgcolor="#eeeeee"><font face="Verdana" size="1"><strong>' . strtoupper($key) . '</strong></font></td><td bgcolor="#eeeeee"><font face="Verdana" size="1">' . nl2br($HtmlValue) . '&nbsp;</font></td></tr>';
                 }
             }
         }
         $htmlContent .= '</table>';
         $this->plainContent = $plainTextContent;
         if ($valueList['html_enabled']) {
             $this->mailMessage->setBody($htmlContent, 'text/html', $this->characterSet);
             $this->mailMessage->addPart($plainTextContent, 'text/plain', $this->characterSet);
         } else {
             $this->mailMessage->setBody($plainTextContent, 'text/plain', $this->characterSet);
         }
         for ($a = 0; $a < 10; $a++) {
             $variableName = 'attachment' . ($a ? $a : '');
             if (!isset($_FILES[$variableName])) {
                 continue;
             }
             if (!is_uploaded_file($_FILES[$variableName]['tmp_name'])) {
                 \TYPO3\CMS\Core\Utility\GeneralUtility::sysLog('Possible abuse of t3lib_formmail: temporary file "' . $_FILES[$variableName]['tmp_name'] . '" ("' . $_FILES[$variableName]['name'] . '") was not an uploaded file.', 'Core', \TYPO3\CMS\Core\Utility\GeneralUtility::SYSLOG_SEVERITY_ERROR);
//.........这里部分代码省略.........
开发者ID:nicksergio,项目名称:TYPO3v4-Core,代码行数:101,代码来源:class.t3lib_formmail.php

示例4: reportEmail

 /**
  * Build and send warning email when new broken links were found
  *
  * @param string $pageSections Content of page section
  * @param array $modTsConfig TSconfig array
  * @return bool TRUE if mail was sent, FALSE if or not
  * @throws \Exception if required modTsConfig settings are missing
  */
 protected function reportEmail($pageSections, array $modTsConfig)
 {
     $content = $this->templateService->substituteSubpart($this->templateMail, '###PAGE_SECTION###', $pageSections);
     /** @var array $markerArray */
     $markerArray = array();
     /** @var array $validEmailList */
     $validEmailList = array();
     /** @var bool $sendEmail */
     $sendEmail = true;
     $markerArray['totalBrokenLink'] = $this->totalBrokenLink;
     $markerArray['totalBrokenLink_old'] = $this->oldTotalBrokenLink;
     // Hook
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['reportEmailMarkers'])) {
         foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['reportEmailMarkers'] as $userFunc) {
             $params = array('pObj' => &$this, 'markerArray' => $markerArray);
             $newMarkers = GeneralUtility::callUserFunction($userFunc, $params, $this);
             if (is_array($newMarkers)) {
                 $markerArray = $newMarkers + $markerArray;
             }
             unset($params);
         }
     }
     $content = $this->templateService->substituteMarkerArray($content, $markerArray, '###|###', true, true);
     /** @var $mail MailMessage */
     $mail = GeneralUtility::makeInstance(MailMessage::class);
     if (empty($modTsConfig['mail.']['fromemail'])) {
         $modTsConfig['mail.']['fromemail'] = MailUtility::getSystemFromAddress();
     }
     if (empty($modTsConfig['mail.']['fromname'])) {
         $modTsConfig['mail.']['fromname'] = MailUtility::getSystemFromName();
     }
     if (GeneralUtility::validEmail($modTsConfig['mail.']['fromemail'])) {
         $mail->setFrom(array($modTsConfig['mail.']['fromemail'] => $modTsConfig['mail.']['fromname']));
     } else {
         throw new \Exception($this->getLanguageService()->sL('LLL:EXT:linkvalidator/Resources/Private/Language/locallang.xlf:tasks.error.invalidFromEmail'), '1295476760');
     }
     if (GeneralUtility::validEmail($modTsConfig['mail.']['replytoemail'])) {
         $mail->setReplyTo(array($modTsConfig['mail.']['replytoemail'] => $modTsConfig['mail.']['replytoname']));
     }
     if (!empty($modTsConfig['mail.']['subject'])) {
         $mail->setSubject($modTsConfig['mail.']['subject']);
     } else {
         throw new \Exception($this->getLanguageService()->sL('LLL:EXT:linkvalidator/Resources/Private/Language/locallang.xlf:tasks.error.noSubject'), '1295476808');
     }
     if (!empty($this->email)) {
         // Check if old input field value is still there and save the value a
         if (strpos($this->email, ',') !== false) {
             $emailList = GeneralUtility::trimExplode(',', $this->email, true);
             $this->email = implode(LF, $emailList);
             $this->save();
         } else {
             $emailList = GeneralUtility::trimExplode(LF, $this->email, true);
         }
         foreach ($emailList as $emailAdd) {
             if (!GeneralUtility::validEmail($emailAdd)) {
                 throw new \Exception($this->getLanguageService()->sL('LLL:EXT:linkvalidator/Resources/Private/Language/locallang.xlf:tasks.error.invalidToEmail'), '1295476821');
             } else {
                 $validEmailList[] = $emailAdd;
             }
         }
     }
     if (is_array($validEmailList) && !empty($validEmailList)) {
         $mail->setTo($validEmailList);
     } else {
         $sendEmail = false;
     }
     if ($sendEmail) {
         $mail->setBody($content, 'text/html');
         $mail->send();
     }
     return $sendEmail;
 }
开发者ID:dachcom-digital,项目名称:TYPO3.CMS,代码行数:80,代码来源:ValidatorTask.php

示例5: setFrom

 /**
  * Sets the sender of the mail message
  *
  * Mostly the sender is a combination of the name and the email address
  *
  * @return void
  */
 protected function setFrom()
 {
     if (isset($this->typoScript['senderEmail'])) {
         $fromEmail = $this->formUtility->renderItem($this->typoScript['senderEmail.'], $this->typoScript['senderEmail']);
     } elseif ($this->getTypoScriptValueFromIncomingData('senderEmailField') !== null) {
         $fromEmail = $this->getTypoScriptValueFromIncomingData('senderEmailField');
     } else {
         $fromEmail = $GLOBALS['TYPO3_CONF_VARS']['MAIL']['defaultMailFromAddress'];
     }
     if (!GeneralUtility::validEmail($fromEmail)) {
         $fromEmail = MailUtility::getSystemFromAddress();
     }
     if (isset($this->typoScript['senderName'])) {
         $fromName = $this->formUtility->renderItem($this->typoScript['senderName.'], $this->typoScript['senderName']);
     } elseif ($this->getTypoScriptValueFromIncomingData('senderNameField') !== null) {
         $fromName = $this->getTypoScriptValueFromIncomingData('senderNameField');
     } else {
         $fromName = $GLOBALS['TYPO3_CONF_VARS']['MAIL']['defaultMailFromName'];
     }
     $fromName = $this->sanitizeHeaderString($fromName);
     if (!empty($fromName)) {
         $from = array($fromEmail => $fromName);
     } else {
         $from = $fromEmail;
     }
     $this->mailMessage->setFrom($from);
 }
开发者ID:graurus,项目名称:testgit_t37,代码行数:34,代码来源:MailPostProcessor.php

示例6: setFrom

 /**
  * Sets the sender of the mail message
  *
  * Mostly the sender is a combination of the name and the email address
  *
  * @return void
  */
 protected function setFrom()
 {
     $fromEmail = '';
     if ($this->typoScript['senderEmail']) {
         $fromEmail = $this->typoScript['senderEmail'];
     } elseif ($this->requestHandler->has($this->typoScript['senderEmailField'])) {
         $fromEmail = $this->requestHandler->get($this->typoScript['senderEmailField']);
     } else {
         $fromEmail = $GLOBALS['TYPO3_CONF_VARS']['MAIL']['defaultMailFromAddress'];
     }
     if (!\TYPO3\CMS\Core\Utility\GeneralUtility::validEmail($fromEmail)) {
         $fromEmail = \TYPO3\CMS\Core\Utility\MailUtility::getSystemFromAddress();
     }
     $fromName = '';
     if ($this->typoScript['senderName']) {
         $fromName = $this->typoScript['senderName'];
     } elseif ($this->requestHandler->has($this->typoScript['senderNameField'])) {
         $fromName = $this->requestHandler->get($this->typoScript['senderNameField']);
     } else {
         $fromName = $GLOBALS['TYPO3_CONF_VARS']['MAIL']['defaultMailFromName'];
     }
     $fromName = $this->sanitizeHeaderString($fromName);
     if (preg_match('/\\s|,/', $fromName) >= 1) {
         $fromName = '"' . $fromName . '"';
     }
     $from = array($fromEmail => $fromName);
     $this->mailMessage->setFrom($from);
 }
开发者ID:noxludo,项目名称:TYPO3v4-Core,代码行数:35,代码来源:MailPostProcessor.php

示例7: reportEmail

 /**
  * Build and send warning email when new broken links were found
  *
  * @param string $pageSections Content of page section
  * @param array $modTsConfig TSconfig array
  * @return boolean TRUE if mail was sent, FALSE if or not
  * @throws \Exception if required modTsConfig settings are missing
  */
 protected function reportEmail($pageSections, array $modTsConfig)
 {
     $content = \TYPO3\CMS\Core\Html\HtmlParser::substituteSubpart($this->templateMail, '###PAGE_SECTION###', $pageSections);
     /** @var array $markerArray */
     $markerArray = array();
     /** @var array $validEmailList */
     $validEmailList = array();
     /** @var boolean $sendEmail */
     $sendEmail = TRUE;
     $markerArray['totalBrokenLink'] = $this->totalBrokenLink;
     $markerArray['totalBrokenLink_old'] = $this->oldTotalBrokenLink;
     // Hook
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['reportEmailMarkers'])) {
         foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['reportEmailMarkers'] as $userFunc) {
             $params = array('pObj' => &$this, 'markerArray' => $markerArray);
             $newMarkers = GeneralUtility::callUserFunction($userFunc, $params, $this);
             if (is_array($newMarkers)) {
                 $markerArray = GeneralUtility::array_merge($markerArray, $newMarkers);
             }
             unset($params);
         }
     }
     $content = \TYPO3\CMS\Core\Html\HtmlParser::substituteMarkerArray($content, $markerArray, '###|###', TRUE, TRUE);
     /** @var $mail \TYPO3\CMS\Core\Mail\MailMessage */
     $mail = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Mail\\MailMessage');
     if (empty($modTsConfig['mail.']['fromemail'])) {
         $modTsConfig['mail.']['fromemail'] = \TYPO3\CMS\Core\Utility\MailUtility::getSystemFromAddress();
     }
     if (empty($modTsConfig['mail.']['fromname'])) {
         $modTsConfig['mail.']['fromname'] = \TYPO3\CMS\Core\Utility\MailUtility::getSystemFromName();
     }
     if (GeneralUtility::validEmail($modTsConfig['mail.']['fromemail'])) {
         $mail->setFrom(array($modTsConfig['mail.']['fromemail'] => $modTsConfig['mail.']['fromname']));
     } else {
         throw new \Exception($GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/Resources/Private/Language/locallang.xlf:tasks.error.invalidFromEmail'), '1295476760');
     }
     if (GeneralUtility::validEmail($modTsConfig['mail.']['replytoemail'])) {
         $mail->setReplyTo(array($modTsConfig['mail.']['replytoemail'] => $modTsConfig['mail.']['replytoname']));
     }
     if (!empty($modTsConfig['mail.']['subject'])) {
         $mail->setSubject($modTsConfig['mail.']['subject']);
     } else {
         throw new \Exception($GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/Resources/Private/Language/locallang.xlf:tasks.error.noSubject'), '1295476808');
     }
     if (!empty($this->email)) {
         $emailList = GeneralUtility::trimExplode(',', $this->email);
         foreach ($emailList as $emailAdd) {
             if (!GeneralUtility::validEmail($emailAdd)) {
                 throw new \Exception($GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/Resources/Private/Language/locallang.xlf:tasks.error.invalidToEmail'), '1295476821');
             } else {
                 $validEmailList[] = $emailAdd;
             }
         }
     }
     if (is_array($validEmailList) && !empty($validEmailList)) {
         $mail->setTo($validEmailList);
     } else {
         $sendEmail = FALSE;
     }
     if ($sendEmail) {
         $mail->setBody($content, 'text/html');
         $mail->send();
     }
     return $sendEmail;
 }
开发者ID:Mr-Robota,项目名称:TYPO3.CMS,代码行数:73,代码来源:ValidatorTask.php


注:本文中的TYPO3\CMS\Core\Utility\MailUtility::getSystemFromAddress方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。