Back to MailHelper class

Method cleanBody

public static string
cleanBody
(mixed $body)
Cleans any injected headers from the email body.
Parameters
  • string $body email body string.
Returns
  • string Cleaned email body string.
Since
  • 1.7.0
Class: MailHelper
Project: Joomla

Method cleanBody - Source code

/**
 * Cleans any injected headers from the email body.
 *
 * @param   string  $body  email body string.
 *
 * @return  string  Cleaned email body string.
 *
 * @since   1.7.0
 */
public static function cleanBody($body)
{
    // Strip all email headers from a string
    return preg_replace("/((From:|To:|Cc:|Bcc:|Subject:|Content-type:) ([\\S]+))/", '', $body);
}