Overview

Packages

  • Mime

Classes

  • Horde_Mime
  • Horde_Mime_Address
  • Horde_Mime_Exception
  • Horde_Mime_Headers
  • Horde_Mime_Magic
  • Horde_Mime_Mail
  • Horde_Mime_Mdn
  • Horde_Mime_Part
  • Horde_Mime_Translation
  • Overview
  • Package
  • Class
  • Tree

Class Horde_Mime_Mail

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.

Copyright 2007-2012 Horde LLC (http://www.horde.org/)

See the enclosed file COPYING for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.

Package: Mime
Category: Horde
License: LGPL 2.1
Author: Jan Schneider jan@horde.org
Located at Horde/Mime/Mail.php
Methods summary
public
# __construct( array $params = array() )

Constructor.

Constructor.

Parameters

$params
<p>A hash with basic message information. 'charset' is the character set of the message. 'body' is the message body. All other parameters are assumed to be message headers.</p>

Throws

Horde_Mime_Exception
public
# addHeaders( array $headers = array() )

Adds several message headers at once.

Adds several message headers at once.

Parameters

$headers
<p>$header Hash with header names as keys and header contents as values.</p>

Throws

Horde_Mime_Exception
public
# addHeader( string $header, string $value, string $overwrite = null )

Adds a message header.

Adds a message header.

Parameters

$header
The header name.
$value
The header value.
$overwrite
$charset The header value's charset.

Throws

Horde_Mime_Exception
public
# removeHeader( string $header )

Removes a message header.

Removes a message header.

Parameters

$header
The header name.
public
# setBody( string $body, string $charset = null, boolean|integer $wrap = false )

Sets the message body text.

Sets the message body text.

Parameters

$body
The message content.
$charset
The character set of the message.
$wrap
<p>If true, wrap the message at column 76; If an integer wrap the message at that column. Don't use wrapping if sending flowed messages.</p>
public
# setHtmlBody( string $body, string $charset = null, boolean $alternative = true )

Sets the HTML message body text.

Sets the HTML message body text.

Parameters

$body
The message content.
$charset
The character set of the message.
$alternative
<p>If true, a multipart/alternative message is created and the text/plain part is generated automatically. If false, a text/html message is generated.</p>
public integer
# addPart( string $mime_type, string $content, string $charset = 'us-ascii', string $disposition = null )

Adds a message part.

Adds a message part.

Parameters

$mime_type
The content type of the part.
$content
The content of the part.
$charset
The character set of the part.
$disposition
The content disposition of the part.

Returns

integer
The part number.
public integer
# addMimePart( Horde_Mime_Part $part )

Adds a MIME message part.

Adds a MIME message part.

Parameters

$part
A Horde_Mime_Part object.

Returns

integer
The part number.
public
# setBasePart( Horde_Mime_Part $part )

Sets the base MIME part.

Sets the base MIME part.

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

Parameters

$part
A Horde_Mime_Part object.
public integer
# addAttachment( string $file, string $name = null, string $type = null, string $charset = 'us-ascii' )

Adds an attachment.

Adds an attachment.

Parameters

$file
The path to the file.
$name
The file name to use for the attachment.
$type
The content type of the file.
$charset
<p>The character set of the part (only relevant for text parts.</p>

Returns

integer
The part number.
public
# removePart( integer $part )

Removes a message part.

Removes a message part.

Parameters

$part
The part number.
public
# clearParts( )

Removes all (additional) message parts but leaves the body parts untouched.

Removes all (additional) message parts but leaves the body parts untouched.

Since

Horde_Mime 1.2.0
public
# addRecipients( string|array $recipients )

Adds message recipients.

Adds message recipients.

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

Parameters

$recipients
<p>of recipients, either as a comma separated list or as an array of email addresses.</p>

Throws

Horde_Mime_Exception
public
# removeRecipients( string|array $recipients )

Removes message recipients.

Removes message recipients.

Parameters

$recipients
<p>of recipients, either as a comma separated list or as an array of email addresses.</p>

Throws

Horde_Mime_Exception
public
# clearRecipients( )

Removes all message recipients.

Removes all message recipients.

public
# send( Mail $mailer, boolean $resend = false, boolean $flowed = true )

Sends this message.

Sends this message.

Parameters

$mailer
A Mail object.
$resend
<p>If true, the message id and date are re-used; If false, they will be updated.</p>
$flowed
Send message in flowed text format.

Throws

Horde_Mime_Exception
API documentation generated by ApiGen