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


PHP Email::replyTo方法代码示例

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


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

示例1: dosave

 /**
  * Form action handler for ContactInquiryForm.
  *
  * @param array $data The form request data submitted
  * @param Form $form The {@link Form} this was submitted on
  */
 function dosave(array $data, Form $form, SS_HTTPRequest $request)
 {
     $SQLData = Convert::raw2sql($data);
     $attrs = $form->getAttributes();
     if ($SQLData['Comment'] != '' || $SQLData['Url'] != '') {
         // most probably spam - terminate silently
         Director::redirect(Director::baseURL() . $this->URLSegment . "/success");
         return;
     }
     $item = new ContactInquiry();
     $form->saveInto($item);
     // $form->sessionMessage(_t("ContactPage.FORMMESSAGEGOOD", "Your inquiry has been submitted. Thanks!"), 'good');
     $item->write();
     $mailFrom = $this->currController->MailFrom ? $this->currController->MailFrom : $SQLData['Email'];
     $mailTo = $this->currController->MailTo ? $this->currController->MailTo : Email::getAdminEmail();
     $mailSubject = $this->currController->MailSubject ? $this->currController->MailSubject . ' - ' . $SQLData['Ref'] : _t('ContactPage.SUBJECT', '[web] New contact inquiry - ') . ' ' . $data['Ref'];
     $email = new Email($mailFrom, $mailTo, $mailSubject);
     $email->replyTo($SQLData['Email']);
     $email->setTemplate("ContactInquiry");
     $email->populateTemplate($SQLData);
     $email->send();
     // $this->controller->redirectBack();
     if ($email->send()) {
         $this->controller->redirect($this->controller->Link() . "success");
     } else {
         $this->controller->redirect($this->controller->Link() . "error");
     }
     return false;
 }
开发者ID:helpfulrobot,项目名称:jelicanin-silverstripe-contact-page,代码行数:35,代码来源:ContactInquiryForm.php

示例2: SendSSEmail

 public static function SendSSEmail($page = false, $EmailFormTo = false, $post_vars = false, $submission = null)
 {
     $arr_path = explode(".", $_SERVER['HTTP_HOST']);
     $email = new Email("forms@" . $arr_path[1] . "." . $arr_path[2], $EmailFormTo, $page->Title . " form submission");
     $email_body = "<html><body>This is a form submission created by this page on your website:<br /><br />" . $_SERVER['HTTP_REFERER'] . "<br /><br />";
     $email_body .= self::FormDataToArray($post_vars, null, null, $submission);
     $email_body .= "</body></html>";
     $email->setBody($email_body);
     $email->replyTo($post_vars['Email']);
     $email->send();
 }
开发者ID:helpfulrobot,项目名称:iqnection-pages-basepages,代码行数:11,代码来源:FormUtilities.php

示例3: doSubmit

 public function doSubmit(array $data, Form $form)
 {
     //basic spam protection
     if ($data['EmailMessage']) {
         $form->addErrorMessage('Message', 'We may have mistakenly marked your message as spam, please contact us via phone or email', 'warning');
         Controller::curr()->redirectBack();
     }
     if (!class_exists('FormSpamProtectionExtension')) {
         $time = time() - 20;
         if ($data['TimeLog'] <= $time) {
             $form->addErrorMessage('Message', 'We may have mistakenly marked your message as spam, please contact us via phone or email', 'warning');
             Controller::curr()->redirectBack();
         }
     }
     $siteConfig = SiteConfig::current_site_config();
     if ($siteConfig->SiteEmail) {
         $From = $siteConfig->SiteEmail;
     } else {
         $From = $siteConfig->MainEmail;
     }
     $To = $siteConfig->SiteEmail;
     $Subject = "Website Contact From " . $data['Name'];
     $Body = $data['Company'] . "<br>\n " . $data['Email'];
     $email = new Email($From, $To, $Subject, $Body);
     $email->replyTo($data['Email']);
     $email->send();
     $redirect = false;
     /*
     if($siteConfig->DefaultThankYouID != 0 && !$data['CustomThankYou']) {
                 $redirect = ThankYouPage::get()->byID($siteConfig->DefaultThankYouID);
             } elseif ($data['CustomThankYou']) {
                 $redirect = ThankYouPage::get()->byID($data['CustomThankYou']);
             }
             
             if($redirect){
                 Controller::curr()->redirect($redirect->URLSegment);
             } else {
                 $form->addErrorMessage('Message', 'Thank you, someone from our office will contact you shortly', 'success');
                 Controller::curr()->redirectBack();
             }
     */
     $form->addErrorMessage('Message', 'Thank you, someone from our office will contact you shortly', 'success');
     Controller::curr()->redirectBack();
 }
开发者ID:thezenmonkey,项目名称:quickstripe,代码行数:44,代码来源:SimpleContactForm.php

示例4: submitenquiry

 public function submitenquiry($data, $form)
 {
     $siteconfig = SiteConfig::current_site_config();
     $to = Email::getAdminEmail();
     $subject = $this->emailsubject ? $this->emailsubject : _t("EnquiryForm.SUBJECT", "Website Contact");
     $form->makeReadOnly();
     $data = array('Values' => $form->Fields());
     if ($this->extraemaildata) {
         $data = array_merge($data, $this->extraemaildata);
     }
     $email = new Email($to, $to, $subject, $this->customise($data)->renderWith($this->emailtemplate));
     if (isset($data['Email']) && Email::is_valid_address($data['Email'])) {
         $email->replyTo($data['Email']);
     }
     $success = $email->send();
     $defaultmessage = "<p class=\"message good\">" . _t("Enquiry.SUCCESS", "Thanks for your contact. We'll be in touch shortly.") . "</p>";
     $content = $siteconfig && $siteconfig->EnquiryContent ? $siteconfig->EnquiryContent : $defaultmessage;
     if (Director::is_ajax()) {
         return "success";
     }
     return new Page_Controller(new Page(array('Title' => _t('Enquiry.Singular', 'Enquiry'), 'Content' => $content, 'EnquiryForm' => '')));
 }
开发者ID:helpfulrobot,项目名称:burnbright-silverstripe-enquiry,代码行数:22,代码来源:EnquiryForm.php

示例5: showPopup

 public function showPopup()
 {
     $objTemplate = new \BackendTemplate('be_formbox');
     $objUser = \BackendUser::getInstance();
     if (\Input::post('FORM_SUBMIT') == 'formbox') {
         $objDate = new \Date();
         $objEmail = new \Email();
         $objEmail->subject = $GLOBALS['TL_CONFIG']['websiteTitle'] . ' - ' . $GLOBALS['TL_CONFIG']['be_formbox_button_text'];
         $strHtml = '<p>User: ' . $objUser->username . ' (' . $objUser->email . ')</p>';
         $strHtml .= '<p>Site: ' . \Input::post('url') . '</p>';
         $strHtml .= '<p>Datum: ' . $objDate->datim . '</p>';
         $strHtml .= '<p>Message: ' . \Input::post('message') . '</p>';
         $objEmail->html = $strHtml;
         $objEmail->replyTo($objUser->name . ' <' . $objUser->email . '>');
         $objEmail->sendTo($GLOBALS['TL_CONFIG']['be_formbox_email']);
         $objTemplate->strMessageSent = $GLOBALS['TL_CONFIG']['be_formbox_message_sent'];
     }
     $objTemplate->strFormUrl = 'contao/main.php?do=undo&key=be-formbox&nb=1&popup=1';
     $objTemplate->strUrl = base64_decode(\Input::get('link'));
     $objTemplate->strFormboxMessage = $GLOBALS['TL_CONFIG']['be_formbox_message'];
     return $objTemplate->parse();
 }
开发者ID:mindbird,项目名称:contao-be-formbox,代码行数:22,代码来源:Formbox.php

示例6: processFormData

 /**
  * Process form data, store it in the session and redirect to the jumpTo page
  *
  * @param array $arrSubmitted
  * @param array $arrLabels
  * @param array $arrFields
  */
 protected function processFormData($arrSubmitted, $arrLabels, $arrFields)
 {
     // HOOK: prepare form data callback
     if (isset($GLOBALS['TL_HOOKS']['prepareFormData']) && is_array($GLOBALS['TL_HOOKS']['prepareFormData'])) {
         foreach ($GLOBALS['TL_HOOKS']['prepareFormData'] as $callback) {
             $this->import($callback[0]);
             $this->{$callback}[0]->{$callback}[1]($arrSubmitted, $arrLabels, $arrFields, $this);
         }
     }
     // Send form data via e-mail
     if ($this->sendViaEmail) {
         $keys = array();
         $values = array();
         $fields = array();
         $message = '';
         foreach ($arrSubmitted as $k => $v) {
             if ($k == 'cc') {
                 continue;
             }
             $v = deserialize($v);
             // Skip empty fields
             if ($this->skipEmpty && !is_array($v) && !strlen($v)) {
                 continue;
             }
             // Add field to message
             $message .= (isset($arrLabels[$k]) ? $arrLabels[$k] : ucfirst($k)) . ': ' . (is_array($v) ? implode(', ', $v) : $v) . "\n";
             // Prepare XML file
             if ($this->format == 'xml') {
                 $fields[] = array('name' => $k, 'values' => is_array($v) ? $v : array($v));
             }
             // Prepare CSV file
             if ($this->format == 'csv') {
                 $keys[] = $k;
                 $values[] = is_array($v) ? implode(',', $v) : $v;
             }
         }
         $recipients = \StringUtil::splitCsv($this->recipient);
         // Format recipients
         foreach ($recipients as $k => $v) {
             $recipients[$k] = str_replace(array('[', ']', '"'), array('<', '>', ''), $v);
         }
         $email = new \Email();
         // Get subject and message
         if ($this->format == 'email') {
             $message = $arrSubmitted['message'];
             $email->subject = $arrSubmitted['subject'];
         }
         // Set the admin e-mail as "from" address
         $email->from = $GLOBALS['TL_ADMIN_EMAIL'];
         $email->fromName = $GLOBALS['TL_ADMIN_NAME'];
         // Get the "reply to" address
         if (strlen(\Input::post('email', true))) {
             $replyTo = \Input::post('email', true);
             // Add name
             if (strlen(\Input::post('name'))) {
                 $replyTo = '"' . \Input::post('name') . '" <' . $replyTo . '>';
             }
             $email->replyTo($replyTo);
         }
         // Fallback to default subject
         if (!strlen($email->subject)) {
             $email->subject = $this->replaceInsertTags($this->subject, false);
         }
         // Send copy to sender
         if (strlen($arrSubmitted['cc'])) {
             $email->sendCc(\Input::post('email', true));
             unset($_SESSION['FORM_DATA']['cc']);
         }
         // Attach XML file
         if ($this->format == 'xml') {
             /** @var \FrontendTemplate|object $objTemplate */
             $objTemplate = new \FrontendTemplate('form_xml');
             $objTemplate->fields = $fields;
             $objTemplate->charset = \Config::get('characterSet');
             $email->attachFileFromString($objTemplate->parse(), 'form.xml', 'application/xml');
         }
         // Attach CSV file
         if ($this->format == 'csv') {
             $email->attachFileFromString(\StringUtil::decodeEntities('"' . implode('";"', $keys) . '"' . "\n" . '"' . implode('";"', $values) . '"'), 'form.csv', 'text/comma-separated-values');
         }
         $uploaded = '';
         // Attach uploaded files
         if (!empty($_SESSION['FILES'])) {
             foreach ($_SESSION['FILES'] as $file) {
                 // Add a link to the uploaded file
                 if ($file['uploaded']) {
                     $uploaded .= "\n" . \Environment::get('base') . str_replace(TL_ROOT . '/', '', dirname($file['tmp_name'])) . '/' . rawurlencode($file['name']);
                     continue;
                 }
                 $email->attachFileFromString(file_get_contents($file['tmp_name']), $file['name'], $file['type']);
             }
         }
         $uploaded = strlen(trim($uploaded)) ? "\n\n---\n" . $uploaded : '';
//.........这里部分代码省略.........
开发者ID:jamesdevine,项目名称:core-bundle,代码行数:101,代码来源:Form.php

示例7: sendmoderatoremail

 /**
  * Helper function to send email to member
  *
  * @param Member $member
  * @param Boolean $write Save to database
  */
 public function sendmoderatoremail()
 {
     $config = SiteConfig::current_site_config();
     foreach ($config->Moderators() as $moderator) {
         try {
             $email = new Email();
             $email->setTemplate('ModerationEmail');
             $email->setTo($moderator->Email);
             $email->replyTo($this->owner->Email);
             $email->setSubject(sprintf(_t('EmailVerifiedMember.NEWMEMBEREMAILSUBJECT', 'New member waiting for moderation at %s'), $config->Title));
             $email->populateTemplate(array('ModerationLink' => Director::absoluteBaseURL() . 'admin/security/EditForm/field/Members/item/' . urlencode($this->owner->ID) . '/edit', 'Moderator' => $moderator, 'Member' => $this->owner, 'SiteTitle' => $config->Title));
             $this->owner->ModerationEmailSent = $email->send();
             //				Debug::Show($email);
         } catch (Exception $e) {
             Debug::Show($e);
         }
     }
     //$this->owner->ModerationEmailSent = $email->send();
 }
开发者ID:helpfulrobot,项目名称:exadium-emailverifiedmember,代码行数:25,代码来源:EmailVerifiedMember.php

示例8: onSubmitCbSendEmail

 /**
  * onsubmit_callback
  * send email
  */
 public function onSubmitCbSendEmail()
 {
     // the save-button is a fileupload-button
     if (!\Input::post('saveNclose')) {
         return;
     }
     $email = new Email();
     $fromMail = $this->User->email;
     $subject = \Input::post('subject');
     $email->replyTo($fromMail);
     $email->from = $fromMail;
     $email->subject = $subject;
     $email->html = base64_decode($_POST['content']);
     //save attachment
     $arrFiles = array();
     $db = $this->Database->prepare('SELECT attachment FROM tl_be_email WHERE id=?')->execute(\Input::get('id'));
     // Attachment
     if ($db->attachment != '') {
         $arrFiles = unserialize($db->attachment);
         foreach ($arrFiles as $filekey => $filename) {
             if (file_exists(TL_ROOT . '/' . BE_EMAIL_UPLOAD_DIR . '/' . $filekey)) {
                 $this->Files->copy(BE_EMAIL_UPLOAD_DIR . '/' . $filekey, 'system/tmp/' . $filename);
                 $email->attachFile(TL_ROOT . '/system/tmp/' . $filename);
             }
         }
     }
     // Cc
     $cc_recipients = array_unique($this->validateEmailAddresses(\Input::post('recipientsCc'), 'recipientsCc'));
     if (count($cc_recipients)) {
         $email->sendCc($cc_recipients);
     }
     // Bcc
     $bcc_recipients = array_unique($this->validateEmailAddresses(\Input::post('recipientsBcc'), 'recipientsBcc'));
     if (count($bcc_recipients)) {
         $email->sendBcc($bcc_recipients);
     }
     // To
     $recipients = array_unique($this->validateEmailAddresses(\Input::post('recipientsTo'), 'recipientsTo'));
     if (count($recipients)) {
         $email->sendTo($recipients);
     }
     // Delete attachment from server
     foreach ($arrFiles as $filekey => $filename) {
         // delete file in the tmp-folder
         if (is_file(TL_ROOT . '/system/tmp/' . $filename)) {
             $this->Files->delete('/system/tmp/' . $filename);
         }
     }
 }
开发者ID:markocupic,项目名称:be_email,代码行数:53,代码来源:tl_be_email.php

示例9: SendEnquiryForm

 public function SendEnquiryForm($data, $form)
 {
     $From = $this->EmailFrom;
     $To = $this->EmailTo;
     $Subject = $this->EmailSubject;
     $email = new Email($From, $To, $Subject);
     $replyTo = $this->EnquiryFormFields()->filter(array('FieldType' => 'Email'))->First();
     if ($replyTo) {
         $postField = $this->keyGen($replyTo->FieldName, $replyTo->SortOrder);
         if (isset($data[$postField]) && Email::validEmailAddress($data[$postField])) {
             $email->replyTo($data[$postField]);
         }
     }
     if ($this->EmailBcc) {
         $email->setBcc($this->EmailBcc);
     }
     //abuse / tracking
     $email->addCustomHeader('X-Sender-IP', $_SERVER['REMOTE_ADDR']);
     //set template
     $email->setTemplate('EnquiryFormEmail');
     //populate template
     $templateData = $this->getTemplateData($data);
     $email->populateTemplate($templateData);
     //send mail
     $email->send();
     //return to submitted message
     if (Director::is_ajax()) {
         return $this->renderWith('EnquiryPageAjaxSuccess');
     }
     $this->redirect($this->Link('?success=1#thankyou'));
 }
开发者ID:axllent,项目名称:silverstripe-enquiry-page,代码行数:31,代码来源:EnquiryPage.php

示例10: processSubmittedData


//.........这里部分代码省略.........
                     \Database::getInstance()->prepare("DELETE FROM tl_formdata WHERE id=?")->execute($intOldId);
                 }
             }
             $strRedirectTo = preg_replace('/\\?.*$/', '', \Environment::get('request'));
         }
         // Auto-generate alias
         $strAlias = $this->Formdata->generateAlias($arrOldFormdata['alias'], $arrForm['title'], $intNewId);
         if (strlen($strAlias)) {
             $arrUpd = array('alias' => $strAlias);
             \Database::getInstance()->prepare("UPDATE tl_formdata %s WHERE id=?")->set($arrUpd)->execute($intNewId);
         }
     }
     // Store data in the session to display on confirmation page
     unset($_SESSION['EFP']['FORMDATA']);
     $blnSkipEmptyFields = $arrForm['confirmationMailSkipEmpty'] ? true : false;
     foreach ($arrFormFields as $k => $arrField) {
         $strType = $arrField['formfieldType'];
         $strVal = '';
         if (in_array($strType, $arrFFstorable)) {
             $strVal = $this->Formdata->preparePostValueForMail($arrSubmitted[$k], $arrField, $arrFiles[$k], $blnSkipEmptyFields);
         }
         $_SESSION['EFP']['FORMDATA'][$k] = $strVal;
     }
     $_SESSION['EFP']['FORMDATA']['_formId_'] = $arrForm['id'];
     // Confirmation Mail
     if ($blnFEedit && !$arrForm['sendConfirmationMailOnFrontendEditing']) {
         $arrForm['sendConfirmationMail'] = false;
     }
     if ($arrForm['sendConfirmationMail']) {
         $objMailProperties = new \stdClass();
         $objMailProperties->subject = '';
         $objMailProperties->sender = '';
         $objMailProperties->senderName = '';
         $objMailProperties->replyTo = '';
         $objMailProperties->recipients = array();
         $objMailProperties->messageText = '';
         $objMailProperties->messageHtmlTmpl = '';
         $objMailProperties->messageHtml = '';
         $objMailProperties->attachments = array();
         $objMailProperties->skipEmptyFields = false;
         $objMailProperties->skipEmptyFields = $arrForm['confirmationMailSkipEmpty'] ? true : false;
         // Set the sender as given in form configuration
         list($senderName, $sender) = \String::splitFriendlyEmail($arrForm['confirmationMailSender']);
         $objMailProperties->sender = $sender;
         $objMailProperties->senderName = $senderName;
         // Set the 'reply to' address, if given in form configuration
         if (!empty($arrForm['confirmationMailReplyto'])) {
             list($replyToName, $replyTo) = \String::splitFriendlyEmail($arrForm['confirmationMailReplyto']);
             $objMailProperties->replyTo = strlen($replyToName) ? $replyToName . ' <' . $replyTo . '>' : $replyTo;
         }
         // Set recipient(s)
         $recipientFieldName = $arrForm['confirmationMailRecipientField'];
         $varRecipient = $arrSubmitted[$recipientFieldName];
         if (is_array($varRecipient)) {
             $arrRecipient = $varRecipient;
         } else {
             $arrRecipient = trimsplit(',', $varRecipient);
         }
         if (!empty($arrForm['confirmationMailRecipient'])) {
             $varRecipient = $arrForm['confirmationMailRecipient'];
             $arrRecipient = array_merge($arrRecipient, trimsplit(',', $varRecipient));
         }
         $arrRecipient = array_filter(array_unique($arrRecipient));
         if (!empty($arrRecipient)) {
             foreach ($arrRecipient as $kR => $recipient) {
                 list($recipientName, $recipient) = \String::splitFriendlyEmail($this->replaceInsertTags($recipient, false));
开发者ID:Jobu,项目名称:core,代码行数:67,代码来源:FormdataProcessor.php

示例11: processSubmittedData


//.........这里部分代码省略.........
         $strAlias = $this->FormData->generateAlias($arrOldFormdata['alias'], $arrForm['title'], $intNewId);
         if (strlen($strAlias)) {
             $arrUpd = array('alias' => $strAlias);
             $this->Database->prepare("UPDATE tl_formdata %s WHERE id=?")->set($arrUpd)->execute($intNewId);
         }
     }
     // end form data storage
     // store data in session to display on confirmation page
     unset($_SESSION['EFP']['FORMDATA']);
     $blnSkipEmpty = $arrForm['confirmationMailSkipEmpty'] ? true : false;
     foreach ($arrFormFields as $k => $arrField) {
         $strType = $arrField['type'];
         $strVal = '';
         if (in_array($strType, $arrFFstorable)) {
             $strVal = $this->FormData->preparePostValForMail($arrSubmitted[$k], $arrField, $arrFiles[$k], $blnSkipEmpty);
         }
         $_SESSION['EFP']['FORMDATA'][$k] = $strVal;
     }
     $_SESSION['EFP']['FORMDATA']['_formId_'] = $arrForm['id'];
     // end store data in session
     // Confirmation Mail
     if ($blnFEedit && !$arrForm['sendConfirmationMailOnFrontendEditing']) {
         $arrForm['sendConfirmationMail'] = false;
     }
     if ($arrForm['sendConfirmationMail']) {
         $this->import('String');
         $messageText = '';
         $messageHtml = '';
         $messageHtmlTmpl = '';
         $recipient = '';
         $arrRecipient = array();
         $sender = '';
         $senderName = '';
         $replyTo = '';
         $attachments = array();
         $blnSkipEmpty = $arrForm['confirmationMailSkipEmpty'] ? true : false;
         $sender = $arrForm['confirmationMailSender'];
         if (strlen($sender)) {
             $sender = str_replace(array('[', ']'), array('<', '>'), $sender);
             if (strpos($sender, '<') > 0) {
                 preg_match('/(.*)?<(\\S*)>/si', $sender, $parts);
                 $sender = $parts[2];
                 $senderName = trim($parts[1]);
             }
         }
         $recipientFieldName = $arrForm['confirmationMailRecipientField'];
         $varRecipient = $arrSubmitted[$recipientFieldName];
         if (is_array($varRecipient)) {
             $arrRecipient = $varRecipient;
         } else {
             $arrRecipient = trimsplit(',', $varRecipient);
         }
         if (strlen($arrForm['confirmationMailRecipient'])) {
             $varRecipient = $arrForm['confirmationMailRecipient'];
             $arrRecipient = array_merge($arrRecipient, trimsplit(',', $varRecipient));
         }
         $arrRecipient = array_unique($arrRecipient);
         $subject = $this->String->decodeEntities($arrForm['confirmationMailSubject']);
         $messageText = $this->String->decodeEntities($arrForm['confirmationMailText']);
         $messageHtmlTmpl = $arrForm['confirmationMailTemplate'];
         if ($messageHtmlTmpl != '') {
             $fileTemplate = new File($messageHtmlTmpl);
             if ($fileTemplate->mime == 'text/html') {
                 $messageHtml = $fileTemplate->getContent();
             }
         }
开发者ID:jens-wetzel,项目名称:use2,代码行数:67,代码来源:Efp.php

示例12: processFormData

 /**
  * Process form data, store it in the session and redirect to the jumpTo page
  * @param array
  * @param array
  */
 protected function processFormData($arrSubmitted, $arrLabels)
 {
     // Send form data via e-mail
     if ($this->sendViaEmail) {
         $this->import('String');
         $keys = array();
         $values = array();
         $fields = array();
         $message = '';
         foreach ($arrSubmitted as $k => $v) {
             if ($k == 'cc') {
                 continue;
             }
             $v = deserialize($v);
             // Skip empty fields
             if ($this->skipEmpty && !is_array($v) && !strlen($v)) {
                 continue;
             }
             // Add field to message
             $message .= (isset($arrLabels[$k]) ? $arrLabels[$k] : ucfirst($k)) . ': ' . (is_array($v) ? implode(', ', $v) : $v) . "\n";
             // Prepare XML file
             if ($this->format == 'xml') {
                 $fields[] = array('name' => $k, 'values' => is_array($v) ? $v : array($v));
             }
             // Prepare CSV file
             if ($this->format == 'csv') {
                 $keys[] = $k;
                 $values[] = is_array($v) ? implode(',', $v) : $v;
             }
         }
         $recipients = $this->String->splitCsv($this->recipient);
         // Format recipients
         foreach ($recipients as $k => $v) {
             $recipients[$k] = str_replace(array('[', ']', '"'), array('<', '>', ''), $v);
         }
         $email = new Email();
         // Get subject and message
         if ($this->format == 'email') {
             $message = $arrSubmitted['message'];
             $email->subject = $arrSubmitted['subject'];
         }
         // Set the admin e-mail as "from" address
         $email->from = $GLOBALS['TL_ADMIN_EMAIL'];
         $email->fromName = $GLOBALS['TL_ADMIN_NAME'];
         // Get the "reply to" address
         if (strlen($this->Input->post('email', true))) {
             $replyTo = $this->Input->post('email', true);
             // Add name
             if (strlen($this->Input->post('name'))) {
                 $replyTo = '"' . $this->Input->post('name') . '" <' . $replyTo . '>';
             }
             $email->replyTo($replyTo);
         }
         // Fallback to default subject
         if (!strlen($email->subject)) {
             $email->subject = $this->replaceInsertTags($this->subject);
         }
         // Send copy to sender
         if (strlen($arrSubmitted['cc'])) {
             $email->sendCc($this->Input->post('email', true));
             unset($_SESSION['FORM_DATA']['cc']);
         }
         // Attach XML file
         if ($this->format == 'xml') {
             $objTemplate = new FrontendTemplate('form_xml');
             $objTemplate->fields = $fields;
             $objTemplate->charset = $GLOBALS['TL_CONFIG']['characterSet'];
             $email->attachFileFromString($objTemplate->parse(), 'form.xml', 'application/xml');
         }
         // Attach CSV file
         if ($this->format == 'csv') {
             $email->attachFileFromString($this->String->decodeEntities('"' . implode('";"', $keys) . '"' . "\n" . '"' . implode('";"', $values) . '"'), 'form.csv', 'text/comma-separated-values');
         }
         $uploaded = '';
         // Attach uploaded files
         if (count($_SESSION['FILES'])) {
             foreach ($_SESSION['FILES'] as $file) {
                 // Add a link to the uploaded file
                 if ($file['uploaded']) {
                     $uploaded .= "\n" . $this->Environment->base . str_replace(TL_ROOT . '/', '', dirname($file['tmp_name'])) . '/' . rawurlencode($file['name']);
                     continue;
                 }
                 $email->attachFileFromString(file_get_contents($file['tmp_name']), $file['name'], $file['type']);
             }
         }
         $uploaded = strlen(trim($uploaded)) ? "\n\n---\n" . $uploaded : '';
         // Send e-mail
         $email->text = $this->String->decodeEntities(trim($message)) . $uploaded . "\n\n";
         $email->sendTo($recipients);
     }
     // Store values in the database
     if ($this->storeValues && strlen($this->targetTable)) {
         $arrSet = array();
         // Add timestamp
         if ($this->Database->fieldExists('tstamp', $this->targetTable)) {
//.........这里部分代码省略.........
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:101,代码来源:Form.php

示例13: sendPersonalMessage

 /**
  * Send a personal message
  * @param object
  * @param object
  */
 protected function sendPersonalMessage(Database_Result $objMember, Widget $objWidget)
 {
     $objEmail = new Email();
     $objEmail->from = $GLOBALS['TL_ADMIN_EMAIL'];
     $objEmail->fromName = 'TYPOlight mailer';
     $objEmail->text = $objWidget->value;
     // Add reply to
     if (FE_USER_LOGGED_IN) {
         $this->import('FrontendUser', 'User');
         $replyTo = $this->User->email;
         // Add name
         if (strlen($this->User->firstname)) {
             $replyTo = $this->User->firstname . ' ' . $this->User->lastname . ' <' . $replyTo . '>';
         }
         $objEmail->subject = sprintf($GLOBALS['TL_LANG']['MSC']['subjectFeUser'], $this->User->username, $this->Environment->host);
         $objEmail->text .= "\n\n---\n\n" . sprintf($GLOBALS['TL_LANG']['MSC']['sendersProfile'], $this->Environment->base . preg_replace('/show=[0-9]+/', 'show=' . $this->User->id, $this->Environment->request));
         $objEmail->replyTo($replyTo);
     } else {
         $objEmail->subject = sprintf($GLOBALS['TL_LANG']['MSC']['subjectUnknown'], $this->Environment->host);
     }
     // Send e-mail
     $objEmail->sendTo($objMember->email);
     $_SESSION['TL_EMAIL_SENT'] = true;
     $this->reload();
 }
开发者ID:jens-wetzel,项目名称:use2,代码行数:30,代码来源:ModuleMemberlist.php


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