Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Differences Between: [Versions 310 and 400] [Versions 39 and 400]

Copyright 2007-2017 Horde LLC (http://www.horde.org/) See the enclosed file LICENSE for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.

Copyright: 2007-2017 Horde LLC
License: http://www.horde.org/licenses/lgpl21 LGPL 2.1
File Size: 524 lines (16 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Horde_Mime_Mail:: (19 methods):
  __construct()
  addHeaders()
  addHeader()
  addHeaderOb()
  removeHeader()
  setBody()
  setHtmlBody()
  addPart()
  addMimePart()
  setBasePart()
  addAttachment()
  removePart()
  clearParts()
  addRecipients()
  removeRecipients()
  clearRecipients()
  send()
  getRaw()
  getBasePart()


Class: Horde_Mime_Mail  - X-Ref

The Horde_Mime_Mail:: class wraps around the various MIME library classes
to provide a simple interface for creating and sending MIME messages.

All content has to be passed UTF-8 encoded. The charset parameters is used
for the generated message only.

__construct($params = array()   X-Ref
Constructor.

param: array $params  A hash with basic message information. 'charset'

addHeaders($headers = array()   X-Ref
Adds several message headers at once.

param: array $header    Hash with header names as keys and header

addHeader($header, $value, $overwrite = null)   X-Ref
Adds a message header.

param: string $header      The header name.
param: string $value       The header value.
param: boolean $overwrite  If true, an existing header of the same name

addHeaderOb(Horde_Mime_Headers_Element $ob)   X-Ref
Add a Horde_Mime_Headers_Element object to the current header list.

param: Horde_Mime_Headers_Element $ob  Header object to add.

removeHeader($header)   X-Ref
Removes a message header.

param: string $header  The header name.

setBody($body, $charset = null, $wrap = false)   X-Ref
Sets the message body text.

param: string $body             The message content.
param: string $charset          The character set of the message.
param: boolean|integer $wrap    If true, wrap the message at column 76;

setHtmlBody($body, $charset = null, $alternative = true)   X-Ref
Sets the HTML message body text.

param: string $body          The message content.
param: string $charset       The character set of the message.
param: boolean $alternative  If true, a multipart/alternative message is

addPart($mime_type, $content, $charset = 'us-ascii',$disposition = null)   X-Ref
Adds a message part.

return: integer  The part number.
param: string $mime_type    The content type of the part.
param: string $content      The content of the part.
param: string $charset      The character set of the part.
param: string $disposition  The content disposition of the part.

addMimePart($part)   X-Ref
Adds a MIME message part.

return: integer  The part number.
param: Horde_Mime_Part $part  A Horde_Mime_Part object.

setBasePart($part)   X-Ref
Sets the base MIME part.

If the base part is set, any text bodies will be ignored when building
the message.

param: Horde_Mime_Part $part  A Horde_Mime_Part object.

addAttachment($file, $name = null, $type = null,$charset = 'us-ascii')   X-Ref
Adds an attachment.

return: integer  The part number.
param: string $file     The path to the file.
param: string $name     The file name to use for the attachment.
param: string $type     The content type of the file.
param: string $charset  The character set of the part (only relevant for

removePart($part)   X-Ref
Removes a message part.

param: integer $part  The part number.

clearParts()   X-Ref
Removes all (additional) message parts but leaves the body parts
untouched.


addRecipients($recipients)   X-Ref
Adds message recipients.

Recipients specified by To:, Cc:, or Bcc: headers are added
automatically.

param: string|array  List of recipients, either as a comma separated

removeRecipients($recipients)   X-Ref
Removes message recipients.

param: string|array  List of recipients, either as a comma separated

clearRecipients()   X-Ref
Removes all message recipients.


send($mailer, $resend = false, $flowed = true)   X-Ref
Sends this message.

param: Horde_Mail_Transport $mailer A Horde_Mail_Transport object.
param: boolean $resend              If true, the message id and date are re-used;
param: boolean $flowed              Send message in flowed text format.

getRaw($stream = true)   X-Ref
Get the raw email data sent by this object.

return: resource|string  The raw email data.
param: boolean $stream  If true, return a stream resource, otherwise

getBasePart()   X-Ref
Return the base MIME part.

return: Horde_Mime_Part