$tostring = ($name == null ? $address : "\"$name\" <$address>");
// sanitize the from field
- $this->from = $this->_fetchFirstLine($this->from);
- $this->from = trim($input->unsanitize($this->from));
- if (empty($this->from))
- $from = $this->_fetch_first_line($this->from);
- $from = trim($this->registry->unsanitize($from));
++ $from = $this->_fetchFirstLine($this->from);
++ $from = trim($input->unsanitize($from));
++ if (empty($from))
+ {
+ trigger_error('You need to specify a from email address');
+ }
// sanitize the from name
- $this->fromName = $this->_fetchFirstLine($this->fromName);
- $this->fromName = ($this->fromName == '' ? $this->from : trim($input->unsanitize($this->fromName)));
- $fromname = $this->_fetch_first_line($this->fromname);
++ $fromname = $this->_fetchFirstLine($this->fromname);
+ $fromname = ($fromname == '' ? $from : trim($this->registry->unsanitize($fromname)));
+ $fromname = $this->_encodeHeaderValue($this->fromname);
// sanitize the subject
- $this->subject = $this->_fetchFirstLine($this->subject);
- $this->subject = trim($input->unsanitize($this->subject));
- if (empty($this->subject))
- $subject = $this->_fetch_first_line($this->subject);
- $subject = trim($this->registry->unsanitize($subject));
- $subject = $this->_encodeHeaderValue($subject);
++ $subject = $this->_fetchFirstLine($this->subject);
++ $subject = trim($unsanitize($subject));
++ if (empty($subject))
+ {
+ trigger_error('You need to specify a subject for the message');
+ }
// sanitize the body
- $this->bodyText = BSFunctions::ConvertLineBreaks($this->bodyText, $this->delim);
- $this->bodyText = trim($input->unsanitize($this->bodyText, true));
- if (empty($this->bodyText))
- $bodytext = $this->registry->modules['functions']->convert_line_breaks($this->bodytext, $this->delim);
- $bodytext = trim($this->registry->unsanitize($bodytext, true));
++ $bodyText = BSFunctions::ConvertLineBreaks($this->bodyText, $this->delim);
++ $bodyText = trim($input->unsanitize($bodyText, true));
++ if (empty($bodyText))
+ {
+ trigger_error('You need to specify body text before sending the message');
+ }
// attach additional headers
- $headers = $this->registry->modules['functions']->convert_line_breaks($this->headers, $this->delim);
- $headers .= ((!preg_match("#{$this->delim}$#", $headers) AND $headers != '') ? "\n" : '') . "From: \"{$fromname}\" <{$from}>" . $this->delim;
+ $headers = BSFunctions::ConvertLineBreaks($this->headers, $this->delim);
- $headers .= ((!preg_match("#{$this->delim}$#", $headers) AND $headers != '') ? "\n" : '') . "From: \"{$this->fromName}\" <{$this->from}>" . $this->delim;
- $headers .= "Return-Path: {$this->from}" . $this->delim;
++ $headers .= ((!preg_match("#{$this->delim}$#", $headers) AND $headers != '') ? "\n" : '') . "From: \"{$fromName}\" <{$from}>" . $this->delim;
+ $headers .= "Return-Path: {$from}" . $this->delim;
$headers .= "X-Mailer: ISSO Mail Framework \$Revision$" . $this->delim;
$headers .= "MIME-Version: 1.0" . $this->delim;
// see if we need to use mime/multipart
- if ($sendHtml AND !empty($this->bodyHtml) == true)
+ if ($sendhtml AND !empty($bodyhtml) == true)
{
- $boundary = 'ISSO-MULTIPART-' . $this->registry->modules['functions']->rand(10);
+ $boundary = 'ISSO-MULTIPART-' . BSFunctions::Rand(10);
$headers .= "Content-Type: multipart/alternative; boundary=\"$boundary\"" . $this->delim;
- $this->bodyHtml = BSFunctions::ConvertLineBreaks($this->bodyHtml, $this->delim);
- $bodyhtml = $this->registry->modules['functions']->convert_line_breaks($this->bodyhtml, $this->delim);
++ $bodyHtml = BSFunctions::ConvertLineBreaks($this->bodyHtml, $this->delim);
// first part of the message (plaintext)
$body = "--$boundary" . $this->delim;
else
{
$headers .= "Content-Type: text/plain; charset=\"" . $this->charset . "\"" . $this->delim;
- $body = $this->bodyText;
+ $body = $bodytext;
}
$headers .= "Content-Transfer-Encoding: 8bit" . $this->delim;
-
- $headers = trim($headers);
+ $headers = trim($headers);
+
// attempt to send the mail!
- if (mail($tostring, $this->subject, $body, $headers, "-f {$this->from}"))
+ if (mail($tostring, $subject, $body, $headers, "-f {$from}"))
{
- $this->registry->debug("email: sent to $address");
+ BSRegister::Debug("email: sent to $address");
}
else
{