本文整理汇总了PHP中JMailHelper::cleanBody方法的典型用法代码示例。如果您正苦于以下问题:PHP JMailHelper::cleanBody方法的具体用法?PHP JMailHelper::cleanBody怎么用?PHP JMailHelper::cleanBody使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JMailHelper
的用法示例。
在下文中一共展示了JMailHelper::cleanBody方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Process
public function Process()
{
$uid = $this->Params->get("jmessenger_user", NULL);
if (!$uid) {
return true;
}
$body = $this->body();
$body .= $this->attachments();
$body .= PHP_EOL;
$body .= $this->Application->getCfg("sitename") . " - " . $this->CurrentURL() . PHP_EOL;
$body .= "Client: " . $this->ClientIPaddress() . " - " . $_SERVER['HTTP_USER_AGENT'] . PHP_EOL;
$body = nl2br($body);
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->insert($db->quoteName("#__messages"));
$query->set($db->quoteName("user_id_from") . "=" . $db->quote($uid));
$query->set($db->quoteName("user_id_to") . "=" . $db->quote($uid));
$query->set($db->quoteName("date_time") . "=" . $db->quote(JFactory::getDate()->toSql()));
$query->set($db->quoteName("subject") . "=" . $db->quote($this->submittername() . " (" . $this->submitteraddress() . ")"));
$query->set($db->quoteName("message") . "=" . $db->quote(JMailHelper::cleanBody($body)));
$db->setQuery((string) $query);
if (!$db->query()) {
$this->MessageBoard->Add(JText::_($GLOBALS["COM_NAME"] . "_ERR_SENDING_MESSAGE"), B2JMessageBoard::error);
return false;
}
return true;
}
示例2: Process
public function Process()
{
$copy_to_submitter = (bool) JRequest::getVar($this->SafeName("copy_to_submitter" . $this->GetId()), NULL, 'POST') || $this->Params->get("copy_to_submitter", NULL) == 1;
// always send a copy parameter
if (!$copy_to_submitter || !isset($this->FieldsBuilder->Fields['sender1']) || empty($this->FieldsBuilder->Fields['sender1']['Value'])) {
$this->FSession->Clear('filelist');
//JLog::add("Copy email for the submitter skipped.", JLog::INFO, get_class($this));
return true;
}
$mail = JFactory::getMailer();
$this->set_from($mail);
$this->set_to($mail);
$mail->setSubject(JMailHelper::cleanSubject($this->Params->get("email_copy_subject", "")));
// Body
$body = $this->Params->get("email_copy_text", "") . PHP_EOL;
// a blank line
$body .= PHP_EOL;
if ($this->Params->get("email_copy_summary", NULL)) {
$body .= $this->body();
$body .= $this->attachments();
$body .= PHP_EOL;
}
// A null body will raise a mail error, so always add at least a signature.
$body .= "------" . PHP_EOL . $this->Application->getCfg("sitename") . PHP_EOL;
$body = JMailHelper::cleanBody($body);
$mail->setBody($body);
// Clear file list for the next submission of the same users
$this->FSession->Clear('filelist');
$this->send($mail);
return true;
}
示例3: Process
public function Process()
{
$copy_to_submitter = (bool) JRequest::getVar($this->SafeName("copy_to_submitter" . $this->GetId()), NULL, 'POST') || $this->Params->get("copy_to_submitter", NULL) == 1;
if (!$copy_to_submitter || !isset($this->FieldsBuilder->senderEmail->b2jFieldValue) || empty($this->FieldsBuilder->senderEmail->b2jFieldValue)) {
$this->B2JSession->Clear('filelist');
return true;
}
$mail = JFactory::getMailer();
$mail->isHTML(true);
$this->set_from($mail);
$this->set_to($mail);
$mail->setSubject(JMailHelper::cleanSubject($this->Params->get("email_copy_subject", "")));
$body = $this->Params->get("email_copy_text", "") . PHP_EOL;
$body .= PHP_EOL;
if ($this->Params->get("email_copy_summary", NULL)) {
$body .= $this->body();
$body .= PHP_EOL;
$body .= $this->attachments();
$body .= PHP_EOL;
}
$body .= "------" . PHP_EOL . $this->Application->getCfg("sitename") . PHP_EOL;
$body = JMailHelper::cleanBody($body);
$mail->setBody($body);
$this->B2JSession->Clear('filelist');
$this->send($mail);
return true;
}
示例4: Process
public function Process()
{
$mail = JFactory::getMailer();
$this->set_from($mail);
$this->set_to($mail, "to_address", "addRecipient");
$this->set_to($mail, "cc_address", "addCC");
$this->set_to($mail, "bcc_address", "addBCC");
$mail->setSubject($this->subject());
$body = $this->body();
$body .= $this->attachments($mail);
$body .= PHP_EOL;
// Info about url
$body .= JFactory::getConfig()->get("sitename") . " - " . $this->CurrentURL() . PHP_EOL;
// Info about client
$body .= "Client: " . $this->ClientIPaddress() . " - " . $_SERVER['HTTP_USER_AGENT'] . PHP_EOL;
$body = JMailHelper::cleanBody($body);
$mail->setBody($body);
$sent = $this->send($mail);
if ($sent) {
// Notify email send success
$this->MessageBoard->Add($this->Params->get("email_sent_text"), FoxMessageBoard::success);
$this->Logger->Write("Notification email sent.");
}
return $sent;
}
示例5: testCleanBody
/**
* @group framework.mail
* @dataProvider getCleanBodyData
*/
public function testCleanBody( $input, $expected )
{
$this->assertThat(
JMailHelper::cleanBody( $input ),
$this->equalTo( $expected )
);
}
示例6: Process
public function Process()
{
$uid = $this->Params->get("jmessenger_user", NULL);
// No user selected for Joomla messenger
if (!$uid) {
//JLog::add("No recipient selected in Joomla Messenger dispatcher. Private message was not send.", JLog::INFO, get_class($this));
// It's not a problem. Maybe it's even wanted. Return succesful.
return true;
}
$body = $this->body();
$body .= $this->attachments();
$body .= PHP_EOL;
// Info about url
$body .= $this->Application->getCfg("sitename") . " - " . $this->CurrentURL() . PHP_EOL;
// Info about client
$body .= "Client: " . $this->ClientIPaddress() . " - " . $_SERVER['HTTP_USER_AGENT'] . PHP_EOL;
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->insert($db->quoteName("#__messages"));
$query->set($db->quoteName("user_id_from") . "=" . $db->quote($uid));
$query->set($db->quoteName("user_id_to") . "=" . $db->quote($uid));
$query->set($db->quoteName("date_time") . "=" . $db->quote(JFactory::getDate()->toSql()));
$query->set($db->quoteName("subject") . "=" . $db->quote($this->submittername() . " (" . $this->submitteraddress() . ")"));
$query->set($db->quoteName("message") . "=" . $db->quote(JMailHelper::cleanBody($body)));
$db->setQuery((string) $query);
if (!$db->query()) {
//JLog::add($msg, JLog::ERROR, get_class($this));
$this->MessageBoard->Add(JText::_($GLOBALS["COM_NAME"] . "_ERR_SENDING_MESSAGE"), FoxMessageBoard::error);
// Database problems. Return error.
return false;
}
//JLog::add("Private message sent to Joomla messenger.", JLog::INFO, get_class($this));
return true;
}
示例7: Process
public function Process()
{
$uid = $this->Params->get("jmessenger_user", NULL);
// No user selected for Joomla messenger
if (!$uid) {
//JLog::add("No recipient selected in Joomla Messenger dispatcher. Private message was not send.", JLog::INFO, get_class($this));
// It's not a problem. Maybe it's even wanted. Return succesful.
return true;
}
$body = $this->body();
$body .= $this->attachments();
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->insert("#__messages");
$query->columns(array($db->quoteName('user_id_from'), $db->quoteName('user_id_to'), $db->quoteName('date_time'), $db->quoteName('subject'), $db->quoteName('message')));
$query->values($uid . ", " . $uid . ", " . $db->Quote(JFactory::getDate()->toSql()) . ", " . $db->Quote($this->submittername() . " (" . $this->submitteraddress() . ")") . ', ' . $db->Quote(JMailHelper::cleanBody($body)));
$db->setQuery((string) $query);
if (!$db->query()) {
$msg = JText::_($GLOBALS["COM_NAME"] . "_ERR_SENDING_MESSAGE");
//JLog::add($msg, JLog::ERROR, get_class($this));
$this->Messages[] = $msg;
// Database problems. Return error.
return false;
}
//JLog::add("Private message sent to Joomla messenger.", JLog::INFO, get_class($this));
return true;
}
示例8: Process
public function Process()
{
$mail = JFactory::getMailer();
$this->set_from($mail);
$this->set_to($mail, "to_address", "addRecipient");
$this->set_to($mail, "cc_address", "addCC");
$this->set_to($mail, "bcc_address", "addBCC");
$mail->setSubject(JMailHelper::cleanSubject($this->Params->get("email_subject", "")));
$body = $this->body();
$body .= $this->attachments($mail);
$body .= PHP_EOL;
$body .= $this->Application->getCfg("sitename") . " - " . $this->CurrentURL() . PHP_EOL;
$body .= "Client: " . $this->ClientIPaddress() . " - " . $_SERVER['HTTP_USER_AGENT'] . PHP_EOL;
$body = JMailHelper::cleanBody($body);
$mail->setBody($body);
$this->Logger->Write("---------------------------------------------------" . PHP_EOL . $body);
return $this->send($mail);
}
示例9: Process
public function Process()
{
$uid = $this->Params->get("jmessenger_user", NULL);
// No user selected for Joomla messenger
if (!$uid) {
//JLog::add("No recipient selected in Joomla Messenger dispatcher. Private message was not send.", JLog::INFO, get_class($this));
// It's not a problem. Maybe it's even wanted. Return succesful.
return true;
}
$body = $this->body();
$body .= $this->attachments();
$body .= PHP_EOL;
// Info about url
$body .= JFactory::getConfig()->get("sitename") . " - " . $this->CurrentURL() . PHP_EOL;
// Info about client
$body .= "Client: " . $this->ClientIPaddress() . " - " . $_SERVER['HTTP_USER_AGENT'] . PHP_EOL;
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->insert($db->quoteName("#__messages"));
$query->set($db->quoteName("user_id_from") . "=" . $db->quote($uid));
$query->set($db->quoteName("user_id_to") . "=" . $db->quote($uid));
$query->set($db->quoteName("date_time") . "=" . $db->quote(JFactory::getDate()->toSql()));
$query->set($db->quoteName("subject") . "=" . $db->quote($this->submittername() . " (" . $this->submitteraddress() . ")"));
$query->set($db->quoteName("message") . "=" . $db->quote(JMailHelper::cleanBody($body)));
$db->setQuery((string) $query);
try {
$db->execute();
} catch (RuntimeException $e) {
// Show a generic database error
$this->MessageBoard->Add(JText::_("COM_FOXCONTACT_ERR_SENDING_MESSAGE"), FoxMessageBoard::error);
// Log the details which may contain sensitive data
$this->Logger->Write($e->getMessage());
// Database problems. Return error.
return false;
}
// Log the successful event to the database. Intentionally not in the user's language.
$this->Logger->Write("Private message sent to Joomla messenger.");
//JLog::add("Private message sent to Joomla messenger.", JLog::INFO, get_class($this));
return true;
}
示例10: Process
public function Process()
{
$application = JFactory::getApplication();
$copy_to_submitter = $application->input->post->get($this->SafeName("copy_to_submitter" . $this->GetId()), false, "bool") || $this->Params->get("copy_to_submitter", null) == 1;
// always send a copy parameter
if (!$copy_to_submitter || !isset($this->FieldsBuilder->Fields['sender1']) || empty($this->FieldsBuilder->Fields['sender1']['Value'])) {
$this->session->clear("filelist", $this->namespace);
//JLog::add("Copy email for the submitter skipped.", JLog::INFO, get_class($this));
return true;
}
$mail = JFactory::getMailer();
$this->set_from($mail);
$this->set_to($mail);
$mail->setSubject(JMailHelper::cleanSubject($this->Params->get("email_copy_subject", "")));
// Body
$body = $this->Params->get("email_copy_text", "") . PHP_EOL;
// a blank line
$body .= PHP_EOL;
if ($this->Params->get("email_copy_summary", null)) {
$body .= $this->body();
$body .= $this->attachments();
$body .= PHP_EOL;
}
// A null body will raise a mail error, so always add at least a signature.
$body .= "------" . PHP_EOL . JFactory::getConfig()->get("sitename") . PHP_EOL;
$body = JMailHelper::cleanBody($body);
$mail->setBody($body);
// Clear file list for the next submission of the same users
$this->session->clear("filelist", $this->namespace);
$sent = $this->send($mail);
if ($sent) {
// Notify email send success
$this->Logger->Write("Copy email sent.");
}
return $sent;
}
示例11: sendEditCoupon
function sendEditCoupon(&$item, &$field, $email, $token)
{
$db = JFactory::getDbo();
$app = JFactory::getApplication();
$SiteName = $app->getCfg('sitename');
$mailfrom = $app->getCfg('mailfrom');
$fromname = $app->getCfg('fromname');
// Check for a valid from address
if (!$mailfrom || !JMailHelper::isEmailAddress($mailfrom)) {
$notice = JText::sprintf('FLEXI_ACCOUNT_V_SUBMIT_INVALID_EMAIL', $mailfrom);
JError::raiseWarning(0, $notice);
}
$subject = JText::sprintf('FLEXI_ACCOUNT_V_SUBMIT_YOUR_NEW_ITEM_AT', $SiteName);
$desc = JText::_($field->parameters->get('coupon_desc'), '...');
$link = JRoute::_(JURI::root(false) . FlexicontentHelperRoute::getItemRoute($item->id, $item->catid) . '&task=edit&edittok=' . $token);
// Build the message to send
$body = JText::sprintf('FLEXI_ACCOUNT_V_SUBMIT_EDIT_LINK_SEND_INFO', $SiteName, $fromname, $mailfrom, $link);
$body .= "\n\n" . $desc;
// Extra text
// Clean the email data
$emailSubject = JMailHelper::cleanSubject($subject);
$emailBody = JMailHelper::cleanBody($body);
$fromname = JMailHelper::cleanAddress($fromname);
$recipient = array($email);
$html_mode = true;
$cc = null;
$bcc = null;
$attachment = null;
$replyto = null;
$replytoname = null;
// Send the email
$send_result = JFactory::getMailer()->sendMail($mailfrom, $fromname, $recipient, $emailSubject, $emailBody, $html_mode, $cc, $bcc, $attachment, $replyto, $replytoname);
if ($send_result !== true) {
JError::raiseWarning(500, JText::_('FLEXI_ACCOUNT_V_SUBMIT_EDIT_LINK_NOT_SENT'));
return false;
}
return true;
}
示例12: _sendReportToMail
protected function _sendReportToMail($message, $subject, $emailToList)
{
jimport('joomla.mail.helper');
$sender = JMailHelper::cleanAddress($this->config->board_title . ' ' . JText::_('COM_KUNENA_GEN_FORUM') . ': ' . $this->_getSenderName());
$subject = JMailHelper::cleanSubject($subject);
$message = JMailHelper::cleanBody($message);
foreach ($emailToList as $emailTo) {
if (!$emailTo->email || !JMailHelper::isEmailAddress($emailTo->email)) {
continue;
}
JUtility::sendMail($this->config->email, $sender, $emailTo->email, $subject, $message);
}
$this->app->enqueueMessage(JText::_('COM_KUNENA_REPORT_SUCCESS'));
while (@ob_end_clean()) {
}
$this->app->redirect(CKunenaLink::GetThreadPageURL('view', $this->catid, $this->id, NULL, NULL, $this->id, false));
}
示例13: share_file_email
//.........这里部分代码省略.........
$query = 'SELECT f.id, f.filename, f.altname, f.secure, f.url,' . ' i.title as item_title, i.introtext as item_introtext, i.fulltext as item_fulltext, u.email as item_owner_email, ' . ' CASE WHEN CHAR_LENGTH(i.alias) THEN CONCAT_WS(\':\', i.id, i.alias) ELSE i.id END as itemslug,' . ' CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(\':\', c.id, c.alias) ELSE c.id END as catslug' . ' FROM #__flexicontent_fields_item_relations AS rel' . ' LEFT JOIN #__flexicontent_files AS f ON f.id = rel.value' . ' LEFT JOIN #__flexicontent_fields AS fi ON fi.id = rel.field_id' . ' LEFT JOIN #__content AS i ON i.id = rel.item_id' . ' LEFT JOIN #__categories AS c ON c.id = i.catid' . ' LEFT JOIN #__flexicontent_items_ext AS ie ON ie.item_id = i.id' . ' LEFT JOIN #__flexicontent_types AS ty ON ie.type_id = ty.id' . ' LEFT JOIN #__users AS u ON u.id = i.created_by' . $access_clauses['join'] . ' WHERE rel.item_id = ' . $content_id . ' AND rel.field_id = ' . $field_id . ' AND f.id = ' . $file_id . ' AND f.published= 1' . $access_clauses['and'];
$db->setQuery($query);
$file = $db->loadObject();
if ($db->getErrorNum()) {
jexit(__FUNCTION__ . '(): SQL QUERY ERROR:<br/>' . nl2br($db->getErrorMsg()));
}
if (empty($file)) {
// this is normally not reachable because the share link should not have been displayed for the user, but it is reachable if e.g. user session has expired
jexit(JText::_('FLEXI_ALERTNOTAUTH') . "File data not found OR no access for file #: " . $file_id . " of content #: " . $content_id . " in field #: " . $field_id);
}
$coupon_vars = '';
if ($field_params->get('enable_coupons', 0)) {
// Insert new download coupon into the DB, in the case the file is sent to a user with no ACCESS
$coupon_token = uniqid();
// create coupon token
$query = ' INSERT #__flexicontent_download_coupons ' . 'SET user_id = ' . (int) $user->id . ', file_id = ' . $file_id . ', token = ' . $db->Quote($coupon_token) . ', hits = 0' . ', hits_limit = ' . (int) $field_params->get('coupon_hits_limit', 3) . ', expire_on = NOW() + INTERVAL ' . (int) $field_params->get('coupon_expiration_days', 15) . ' DAY';
$db->setQuery($query);
$db->execute();
$coupon_id = $db->insertid();
// get id of newly created coupon
$coupon_vars = '&conid=' . $coupon_id . '&contok=' . $coupon_token;
}
$uri = JURI::getInstance();
$base = $uri->toString(array('scheme', 'host', 'port'));
$vars = '&id=' . $file_id . '&cid=' . $content_id . '&fid=' . $field_id . $coupon_vars;
$link = $base . JRoute::_('index.php?option=com_flexicontent&task=download' . $vars, false);
// Verify that this is a local link
if (!$link || !JURI::isInternal($link)) {
//Non-local url...
JError::raiseNotice(500, JText::_('FLEXI_FIELD_FILE_EMAIL_NOT_SENT'));
return $this->share_file_form();
}
// An array of email headers we do not want to allow as input
$headers = array('Content-Type:', 'MIME-Version:', 'Content-Transfer-Encoding:', 'bcc:', 'cc:');
// An array of the input fields to scan for injected headers
$fields = array('mailto', 'sender', 'from', 'subject');
/*
* Here is the meat and potatoes of the header injection test. We
* iterate over the array of form input and check for header strings.
* If we find one, send an unauthorized header and die.
*/
foreach ($fields as $field) {
foreach ($headers as $header) {
if (strpos($_POST[$field], $header) !== false) {
JError::raiseError(403, '');
}
}
}
/*
* Free up memory
*/
unset($headers, $fields);
$email = JRequest::getString('mailto', '', 'post');
echo "<br>";
$sender = JRequest::getString('sender', '', 'post');
echo "<br>";
$from = JRequest::getString('from', '', 'post');
echo "<br>";
$_subject = JText::sprintf('FLEXI_FIELD_FILE_SENT_BY', $sender);
echo "<br>";
$subject = JRequest::getString('subject', $_subject, 'post');
echo "<br>";
$desc = JRequest::getString('desc', '', 'post');
echo "<br>";
// Check for a valid to address
$error = false;
if (!$email || !JMailHelper::isEmailAddress($email)) {
$error = JText::sprintf('FLEXI_FIELD_FILE_EMAIL_INVALID', $email);
JError::raiseWarning(0, $error);
}
// Check for a valid from address
if (!$from || !JMailHelper::isEmailAddress($from)) {
$error = JText::sprintf('FLEXI_FIELD_FILE_EMAIL_INVALID', $from);
JError::raiseWarning(0, $error);
}
if ($error) {
return $this->share_file_form();
}
// Build the message to send
$body = JText::sprintf('FLEXI_FIELD_FILE_EMAIL_MSG', $SiteName, $sender, $from, $link);
$body .= "\n\n" . JText::_('FLEXI_FIELD_FILE_EMAIL_SENDER_NOTES') . ":\n\n" . $desc;
// Clean the email data
$subject = JMailHelper::cleanSubject($subject);
$body = JMailHelper::cleanBody($body);
$sender = JMailHelper::cleanAddress($sender);
$html_mode = false;
$cc = null;
$bcc = null;
$attachment = null;
$replyto = null;
$replytoname = null;
// Send the email
$send_result = JFactory::getMailer()->sendMail($from, $sender, $email, $subject, $body, $html_mode, $cc, $bcc, $attachment, $replyto, $replytoname);
if ($send_result !== true) {
JError::raiseNotice(500, JText::_('FLEXI_FIELD_FILE_EMAIL_NOT_SENT'));
return $this->share_file_form();
}
$document->addStyleSheetVersion(JURI::base(true) . '/components/com_flexicontent/assets/css/flexicontent.css', FLEXI_VHASH);
include 'file' . DS . 'share_result.php';
}
示例14: sendEmailToModeratorsPostWFM
function sendEmailToModeratorsPostWFM()
{
// get settings from com_discussions parameters
$params = JComponentHelper::getParams('com_discussions');
$SiteName = $params->get('emailSiteName', '');
$from = $params->get('emailFrom', '');
$sender = $params->get('emailSender', '');
$link = $params->get('emailLink', '');
$subject = $params->get('emailWFMSubject', '');
$msgparam = $params->get('emailWFMMessage', '');
jimport('joomla.mail.helper');
$db =& JFactory::getDBO();
// get all moderators with email notifications set
$sql = "SELECT u.username, u.email FROM " . $db->nameQuote('#__users') . " u, " . $db->nameQuote('#__discussions_users') . " d" . " WHERE u.id = d.id AND d.moderator = 1 AND d.email_notification = 1";
$db->setQuery($sql);
$_moderator_list = $db->loadAssocList();
reset($_moderator_list);
while (list($key, $val) = each($_moderator_list)) {
$username = $_moderator_list[$key]['username'];
$email = $_moderator_list[$key]['email'];
if (JMailHelper::isEmailAddress($email)) {
// construct email
$msg = $username . ", \n\n" . $msgparam;
$body = sprintf($msg, $SiteName, $sender, $from, $link);
// Clean the email data
$subject = JMailHelper::cleanSubject($subject);
$body = JMailHelper::cleanBody($body);
$sender = JMailHelper::cleanAddress($sender);
JUtility::sendMail($from, $sender, $email, $subject, $body);
}
}
return 0;
}
示例15: sendEmail
function sendEmail($configData,$formData)
{
// build the message body from the configured fields
$body = "From ".$formData['fromName']." at ".$formData['fromAddress']."\r\n";
if (!empty($formData['list1']))
$body .= $configData['list_prompt'].": ".$configData['list_array'][$formData['list1']]."\r\n";
if (!empty($formData['line1']))
$body .= $configData['line1_prompt'].": ".$formData['line1']."\r\n";
if (!empty($formData['line2']))
$body .= $configData['line2_prompt'].": ".$formData['line2']."\r\n";
if (!empty($formData['line3']))
$body .= $configData['line3_prompt'].": ".$formData['line3']."\r\n";
if (!empty($formData['line4']))
$body .= $configData['line4_prompt'].": ".$formData['line4']."\r\n";
if (!empty($formData['line5']))
$body .= $configData['line5_prompt'].": ".$formData['line5']."\r\n";
if (!empty($formData['area_data']))
$body .= $configData['area_prompt'].": ".$formData['area_data']."\r\n";
// make sure the body and subject don't contain anything they shouldn't
jimport('joomla.mail.helper');
$body = JMailHelper::cleanBody($body);
$subject = JMailHelper::cleanSubject($formData['subject']);
// get the client information
$ip = getIPaddress();
$ipmsg = "Client IP: ".$ip."\r\n";
$ipmsg .= $_SERVER["HTTP_USER_AGENT"]."\r\n";
// from version 2.11 we now send the mail using the Joomla sendMail function (instead of php mail)
// which uses the mail settings configured in Joomla Global Configuration
$app = &JFactory::getApplication();
$from = $app->getCfg('mailfrom');
$fromname = $app->getCfg('fromname');
$recipient = $configData['toPrimary'];
$cc = $configData['cc'];
$bcc = $configData['bcc'];
$replyto = $formData['fromAddress'];
$replytoname = $formData['fromName'];
// from version 2.15 we build the mail object ourselves so that we can get at the ErrorInfo
$mail =& JFactory::getMailer();
$mail->setSender(array($from, $fromname));
$mail->setSubject($subject);
$mail->setBody($body.$ipmsg);
$mail->addRecipient($recipient);
if ($cc != '')
$mail->addCC($cc);
if ($bcc != '')
$mail->addBCC($bcc);
$mail->addReplyTo(array($replyto, $replytoname));
$ret_main = $mail->Send();
if ($ret_main === true)
$status = "Sent OK\r\n";
else
$status = "Mail was NOT accepted for delivery (".$mail->ErrorInfo.")\r\n";
logText(JText::_('SUBJECT').": $subject\r\n".
"To: $recipient\r\n".
"From: $fromname at $from\r\n".
"Cc: $cc\r\n".
"Bcc: $bcc\r\n".
"ReplyTo: $replytoname at $replyto\r\n".
$ipmsg.
$body.
$status.
"-------------------------\r\n");
// if the user wanted a copy, send that separately
if ($formData['copyMe'] == 1)
{
$mail =& JFactory::getMailer();
$mail->setSender(array($from, $fromname));
$mail->setSubject($subject);
$mail->setBody($body);
$mail->addRecipient($formData['fromAddress']);
$ret_copy = $mail->Send();
if ($ret_copy === true)
$status = "Sent OK\r\n";
else
$status = "Mail was NOT accepted for delivery (".$mail->ErrorInfo.")\r\n";
logText("Copy to: $recipient\r\n".
$status.
"-------------------------\r\n");
}
return $ret_main;
}