I have been searching forums to find a solution to this but I can only find solutions relevant to Joomla 1.5 not 2.5.
I have been modifying a component to include a mass mail function where by you can select from a list of all the users and post the same message.
The reason I do not wish to use the standard Joomla mass mail is that I would like the functionality to select specific users and also I have email templates which have my logo embedded, a background and an opening line which changes names for each user.
Everything works fine apart from when I specify text for the body of the message - all HTML tags are removed.
Even the most basic ones like
Code: Select all
<p> Test </p><p>New Line</p>
Code: Select all
<p>Test New Line</p>
All my filtering is turned off and I am able to edit using HTML in articles, just not in the admin menu.
I have had a look at using JREQUEST_ALLOWHTML for the getVar function, but I get a service error 500.
The only code which seems to be able to pick up my message is:
Code: Select all
$message =& JTable::getInstance('message', 'Table');
the code for the controller of my component in the admin site is:
Code: Select all
function massMail(){
// Check for request forgeries
JRequest::checkToken() or jexit('Invalid Token');
$Itemid = JRequest::getInt('Itemid');
$now = JFactory::getDate();
$user = JFactory::getUser();
$post = JRequest::get('post');
$message =& JTable::getInstance('message', 'Table');
//$message = JRequest::getVar('message', '', 'POST', 'string');
//take all recipients in array
$recipients = JRequest::getVar('id_categ');
//$recipient = JRequest::getVar('recipient', '', 'POST', 'string');
foreach($recipients as $recipient){
$recipientInfo = JFactory::getUser($recipient); //get the recipient info from the recipient's username
//check if the recipient info is valid/username exists
if(empty($recipientInfo)){
$msg = JText::_('COM_JBLANCE_INVALID_USERNAME');
//$link = JRoute::_('index.php?option=com_jblance&view=admproject&layout=dashboard', false);
$link = JRoute::_('index.php?option=com_jblance&view=admproject&layout=mail', false);
$this->setRedirect($link, $msg, 'error');
return false;
}
$message->date_sent = $now->toMySQL();
$message->idFrom = $user->id;
$message->idTo = $recipientInfo->id;
//save the file attachment `if` checked
$chkAttach = JRequest::getVar('chk-attach', 0, 'POST', 'int');
$attachedFile = JRequest::getVar('attached-file', '', 'POST', 'string');
if($chkAttach){
$message->attachment = $attachedFile;
}
else {
$attFile = explode(';', $attachedFile);
$filename = $attFile[1];
$delete = JBMESSAGE_PATH.DS.$filename;
unlink($delete);
}
if(!$message->save($post)){
JError::raiseError(500, $message->getError());
}
//send PM notification email
$jbmail = JblanceHelper::get('helper.email'); // create an instance of the class EmailHelper
$post['idFrom'] = $user->id;
$post['idTo'] = $recipientInfo->id;
$jbmail->massMailNotification($post);
$msg = JText::_('COM_JBLANCE_MESSAGE_SENT_SUCCESSFULLY');
$return = JRoute::_('index.php?option=com_jblance&view=admproject&layout=dashboard', false);
$this->setRedirect($return, $msg);
}
}
Any help would be appreciated
Kind Regards,
Dave