You are here

public function MailMIME::get in Mail MIME 7

Same name and namespace in other branches
  1. 8.2 mailmime.inc \MailMIME::get()
  2. 6.2 mailmime.inc \MailMIME::get()
  3. 6 mailmime.inc \MailMIME::get()
  4. 7.2 mailmime.inc \MailMIME::get()

Builds and returns the full multipart message with all its parts.

Searches for inline file references and attaches local files, if possible.

Parameters

array $params: (optional) An associative array used to override the HTMLMailMime::_build_params values for building this message.

$filename: (optional) The filename where the message data should be written. The default is to return the message data as a string.

$skip_head: (optional) TRUE if only the message body should be generated. Defaults to FALSE: return both headers and body together.

Return value

mixed

  • FALSE: If an error occurred.
  • NULL: If $filename is set and no error occurred.
  • string: The formatted message if $filename is not set and no error occurred.
1 call to MailMIME::get()
MailMIME::toEmail in ./mailmime.inc
Return a (headers, body) pair for sending.

File

./mailmime.inc, line 411
Provides the MailMIME class for creating MIME-formatted email messages.

Class

MailMIME
The MailMIME class is used to create MIME email messages.

Code

public function &get($params = NULL, $filename = NULL, $skip_head = FALSE) {
  if (isset($this->_htmlbody)) {
    $this->_htmlbody = preg_replace_callback(array(
      '#(?<!\\S)(src|background|href)\\s*(=)\\s*(["\'])(?!cid:)(.*?)(\\3)#i',
      '#(?<!\\S)(src|background|href)\\s*(=)(\\s*)(?!"cid:)([^ >]*)(?=[ >])#i',
      '#(?<!\\S)(url)\\s*(\\()\\s*(["\'])(?!cid:)(.*?)(\\3)#i',
      '#(?<!\\S)(url)\\s*(\\()(\\s*)(?!"cid:)([^ )]*)(?=[ )])#i',
    ), array(
      &$this,
      'attachRegex',
    ), $this->_htmlbody);
  }
  return MailMIME::successful(parent::get($params, $filename, $skip_head));
}