本文整理汇总了PHP中RSFormProHelper::sendMail方法的典型用法代码示例。如果您正苦于以下问题:PHP RSFormProHelper::sendMail方法的具体用法?PHP RSFormProHelper::sendMail怎么用?PHP RSFormProHelper::sendMail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RSFormProHelper
的用法示例。
在下文中一共展示了RSFormProHelper::sendMail方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendSubmissionEmails
//.........这里部分代码省略.........
// User Email
foreach ($userEmailUploads as $componentId) {
$name = $properties[$componentId]['NAME'];
if (!empty($submission->values[$name])) {
$userEmail['files'][] = $submission->values[$name];
}
}
// RSForm! Pro Scripting - Admin Email Text
// performance check
if (strpos($form->AdminEmailText, '{if ') !== false && strpos($form->AdminEmailText, '{/if}') !== false) {
require_once dirname(__FILE__) . '/scripting.php';
RSFormProScripting::compile($form->AdminEmailText, $placeholders, $values);
}
$adminEmail = array('to' => str_replace($placeholders, $values, $form->AdminEmailTo), 'cc' => str_replace($placeholders, $values, $form->AdminEmailCC), 'bcc' => str_replace($placeholders, $values, $form->AdminEmailBCC), 'from' => str_replace($placeholders, $values, $form->AdminEmailFrom), 'replyto' => str_replace($placeholders, $values, $form->AdminEmailReplyTo), 'fromName' => str_replace($placeholders, $values, $form->AdminEmailFromName), 'text' => str_replace($placeholders, $values, $form->AdminEmailText), 'subject' => str_replace($placeholders, $values, $form->AdminEmailSubject), 'mode' => $form->AdminEmailMode, 'files' => array());
// admin cc
if (strpos($adminEmail['cc'], ',') !== false) {
$adminEmail['cc'] = explode(',', $adminEmail['cc']);
}
// admin bcc
if (strpos($adminEmail['bcc'], ',') !== false) {
$adminEmail['bcc'] = explode(',', $adminEmail['bcc']);
}
// Admin Email
foreach ($adminEmailUploads as $componentId) {
$name = $properties[$componentId]['NAME'];
if (!empty($submission->values[$name])) {
$adminEmail['files'][] = $submission->values[$name];
}
}
$mainframe->triggerEvent('rsfp_beforeUserEmail', array(array('form' => &$form, 'placeholders' => &$placeholders, 'values' => &$values, 'submissionId' => $SubmissionId, 'userEmail' => &$userEmail)));
// Script called before the User Email is sent.
eval($form->UserEmailScript);
// mail users
if ($userEmail['to']) {
$recipients = explode(',', $userEmail['to']);
RSFormProHelper::sendMail($userEmail['from'], $userEmail['fromName'], $recipients, $userEmail['subject'], $userEmail['text'], $userEmail['mode'], !empty($userEmail['cc']) ? $userEmail['cc'] : null, !empty($userEmail['bcc']) ? $userEmail['bcc'] : null, $userEmail['files'], !empty($userEmail['replyto']) ? $userEmail['replyto'] : '');
}
$mainframe->triggerEvent('rsfp_beforeAdminEmail', array(array('form' => &$form, 'placeholders' => &$placeholders, 'values' => &$values, 'submissionId' => $SubmissionId, 'adminEmail' => &$adminEmail)));
// Script called before the Admin Email is sent.
eval($form->AdminEmailScript);
//mail admins
if ($adminEmail['to']) {
$recipients = explode(',', $adminEmail['to']);
RSFormProHelper::sendMail($adminEmail['from'], $adminEmail['fromName'], $recipients, $adminEmail['subject'], $adminEmail['text'], $adminEmail['mode'], !empty($adminEmail['cc']) ? $adminEmail['cc'] : null, !empty($adminEmail['bcc']) ? $adminEmail['bcc'] : null, $adminEmail['files'], !empty($adminEmail['replyto']) ? $adminEmail['replyto'] : '');
}
//additional emails
$db->setQuery("SELECT * FROM #__rsform_emails WHERE `type` = 'additional' AND `formId` = " . $formId . " AND `from` != ''");
if ($emails = $db->loadObjectList()) {
$etranslations = RSFormProHelper::getTranslations('emails', $formId, $submission->Lang);
foreach ($emails as $email) {
if (isset($etranslations[$email->id . '.fromname'])) {
$email->fromname = $etranslations[$email->id . '.fromname'];
}
if (isset($etranslations[$email->id . '.subject'])) {
$email->subject = $etranslations[$email->id . '.subject'];
}
if (isset($etranslations[$email->id . '.message'])) {
$email->message = $etranslations[$email->id . '.message'];
}
if (empty($email->fromname) || empty($email->subject) || empty($email->message)) {
continue;
}
// RSForm! Pro Scripting - Additional Email Text
// performance check
if (strpos($email->message, '{if ') !== false && strpos($email->message, '{/if}') !== false) {
require_once dirname(__FILE__) . '/scripting.php';
RSFormProScripting::compile($email->message, $placeholders, $values);
}
$additionalEmail = array('to' => str_replace($placeholders, $values, $email->to), 'cc' => str_replace($placeholders, $values, $email->cc), 'bcc' => str_replace($placeholders, $values, $email->bcc), 'from' => str_replace($placeholders, $values, $email->from), 'replyto' => str_replace($placeholders, $values, $email->replyto), 'fromName' => str_replace($placeholders, $values, $email->fromname), 'text' => str_replace($placeholders, $values, $email->message), 'subject' => str_replace($placeholders, $values, $email->subject), 'mode' => $email->mode, 'files' => array());
if (!empty($additionalEmailUploads)) {
foreach ($additionalEmailUploads as $additionalEmailId => $additionalEmailUpload) {
if ($additionalEmailId == $email->id) {
foreach ($additionalEmailUpload as $componentId) {
$name = $properties[$componentId]['NAME'];
if (!empty($submission->values[$name])) {
$additionalEmail['files'][] = $submission->values[$name];
}
}
}
}
}
// additional cc
if (strpos($additionalEmail['cc'], ',') !== false) {
$additionalEmail['cc'] = explode(',', $additionalEmail['cc']);
}
// additional bcc
if (strpos($additionalEmail['bcc'], ',') !== false) {
$additionalEmail['bcc'] = explode(',', $additionalEmail['bcc']);
}
$mainframe->triggerEvent('rsfp_beforeAdditionalEmail', array(array('form' => &$form, 'placeholders' => &$placeholders, 'values' => &$values, 'submissionId' => $SubmissionId, 'additionalEmail' => &$additionalEmail)));
eval($form->AdditionalEmailsScript);
// mail users
if ($additionalEmail['to']) {
$recipients = explode(',', $additionalEmail['to']);
RSFormProHelper::sendMail($additionalEmail['from'], $additionalEmail['fromName'], $recipients, $additionalEmail['subject'], $additionalEmail['text'], $additionalEmail['mode'], !empty($additionalEmail['cc']) ? $additionalEmail['cc'] : null, !empty($additionalEmail['bcc']) ? $additionalEmail['bcc'] : null, $additionalEmail['files'], !empty($additionalEmail['replyto']) ? $additionalEmail['replyto'] : '');
}
}
}
return array($placeholders, $values);
}
示例2: sendEmails
public function sendEmails($formId, $SubmissionId)
{
$directory = $this->getDirectory();
$this->_db->setQuery("SELECT Lang FROM #__rsform_submissions WHERE FormId='" . $formId . "' AND SubmissionId='" . $SubmissionId . "'");
$lang = $this->_db->loadResult();
list($placeholders, $values) = RSFormProHelper::getReplacements($SubmissionId);
$this->_db->setQuery("SELECT * FROM #__rsform_emails WHERE `type` = 'directory' AND `formId` = " . $formId . " AND `from` != ''");
if ($emails = $this->_db->loadObjectList()) {
$etranslations = RSFormProHelper::getTranslations('emails', $formId, $lang);
foreach ($emails as $email) {
if (isset($etranslations[$email->id . '.fromname'])) {
$email->fromname = $etranslations[$email->id . '.fromname'];
}
if (isset($etranslations[$email->id . '.subject'])) {
$email->subject = $etranslations[$email->id . '.subject'];
}
if (isset($etranslations[$email->id . '.message'])) {
$email->message = $etranslations[$email->id . '.message'];
}
if (empty($email->fromname) || empty($email->subject) || empty($email->message)) {
continue;
}
// RSForm! Pro Scripting - Additional Email Text
// performance check
if (strpos($email->message, '{/if}') !== false) {
require_once JPATH_ADMINISTRATOR . '/components/com_rsform/helpers/scripting.php';
RSFormProScripting::compile($email->message, $placeholders, $values);
}
$directoryEmail = array('to' => str_replace($placeholders, $values, $email->to), 'cc' => str_replace($placeholders, $values, $email->cc), 'bcc' => str_replace($placeholders, $values, $email->bcc), 'from' => str_replace($placeholders, $values, $email->from), 'replyto' => str_replace($placeholders, $values, $email->replyto), 'fromName' => str_replace($placeholders, $values, $email->fromname), 'text' => str_replace($placeholders, $values, $email->message), 'subject' => str_replace($placeholders, $values, $email->subject), 'mode' => $email->mode, 'files' => array());
// additional cc
if (strpos($directoryEmail['cc'], ',') !== false) {
$directoryEmail['cc'] = explode(',', $directoryEmail['cc']);
}
// additional bcc
if (strpos($directoryEmail['bcc'], ',') !== false) {
$directoryEmail['bcc'] = explode(',', $directoryEmail['bcc']);
}
//Trigger Event - beforeDirectoryEmail
$this->_app->triggerEvent('rsfp_beforeDirectoryEmail', array(array('directory' => &$directory, 'placeholders' => &$placeholders, 'values' => &$values, 'submissionId' => $SubmissionId, 'directoryEmail' => &$directoryEmail)));
eval($directory->EmailsScript);
// mail users
$recipients = explode(',', $directoryEmail['to']);
if (!empty($recipients)) {
foreach ($recipients as $recipient) {
if (!empty($recipient)) {
RSFormProHelper::sendMail($directoryEmail['from'], $directoryEmail['fromName'], $recipient, $directoryEmail['subject'], $directoryEmail['text'], $directoryEmail['mode'], !empty($directoryEmail['cc']) ? $directoryEmail['cc'] : null, !empty($directoryEmail['bcc']) ? $directoryEmail['bcc'] : null, $directoryEmail['files'], !empty($directoryEmail['replyto']) ? $directoryEmail['replyto'] : '');
}
}
}
}
}
}