Send E-Mails in HTML Format

Gunter
Gunter
Offline
0
If you want to send the E-Mails in a more formatted way, here is the code to change. E-Mails will be send with a formatted table. This automatically applies to the admin mail and the mail sent to the submitter.
(would be nice if this could be included in official build).




b2jadminmailer.php

public function Process()
{
$mail = JFactory::getMailer();
$mail->isHTML(true); // beadsoft.de

$this->set_from($mail);
...


b2jdispatcher.php:

protected function body()
{
$result = '';
foreach ($this->FieldsBuilder->Fields as $key => $field)
{
switch ($field['Type'])
{
case 'sender':
case 'text':
case 'textarea':
case 'dropdown':
case 'checkbox':
case 'date':
$result .= $this->AddToBody($field);
}
}

foreach ($this->FieldsBuilder->DynamicFields as $key => $field)
{
if($field[0]->state != 0){
foreach ($field[1] as $dynamicfield){
$result .= $this->AddToBodyDynamic($dynamicfield);
}
}
}

$result .= '' . PHP_EOL;
return $result;
}

protected function AddToBody(&$field)
{
if (!$field['Display']) return "";
return "'' . " . JFilterInput::getInstance()->clean($field["Name"], "") . ':   ' . PHP_EOL . JFilterInput::getInstance()->clean($field["Value"], "") . '' . PHP_EOL . PHP_EOL;
}

protected function AddToBodyDynamic(&$field)
{
if ($field->b2jFieldState == 0) return "";
return '' . JFilterInput::getInstance()->clean($field->b2jFieldName, "") . ':   ' . PHP_EOL . JFilterInput::getInstance()->clean($field->b2jFieldValue, "") . '' . PHP_EOL . PHP_EOL;
}


Responses (0)
Sorry, but you are not allowed to view the replies here.
Your Reply

Cron Job Starts