Mail_Mime
[ class tree: Mail_Mime ] [ index: Mail_Mime ] [ all elements ]

Class: Mail_mime

Source Location: /pear/Mail/mime.php

Class Overview


The Mail_Mime class provides an OO interface to create MIME enabled email messages. This way you can create emails that contain plain-text bodies, HTML bodies, attachments, inline images and specific headers.


Author(s):

Version:

  • Release: @package_version@

Copyright:

  • 2003-2006 PEAR <pear-group@php.net>

Methods



Class Details

[line 94]
The Mail_Mime class provides an OO interface to create MIME enabled email messages. This way you can create emails that contain plain-text bodies, HTML bodies, attachments, inline images and specific headers.



Tags:

author:  Sean Coates <sean@php.net>
author:  Tomas V.V. Cox <cox@idecnet.com>
author:  Richard Heyes <richard@phpguru.org>
author:  Cipriano Groenendal <cipri@php.net>
version:  Release: @package_version@
copyright:  2003-2006 PEAR <pear-group@php.net>
link:  http://pear.php.net/package/Mail_mime
license:  BSD License


[ Top ]


Class Methods


constructor Mail_mime [line 179]

void Mail_mime( [string $crlf = "\r\n"])

Constructor function.



Tags:

access:  public


Parameters:

string   $crlf   what type of linebreak to use. Defaults to "\r\n"

[ Top ]

method addAttachment [line 330]

mixed addAttachment( string $file, [string $c_type = 'application/octet-stream'], [string $name = ''], [bool $isfile = true], [string $encoding = 'base64'], [string $disposition = 'attachment'], [string $charset = ''], [string $language = ''], [string $location = ''])

Adds a file to the list of attachments.



Tags:

return:  true on success or PEAR_Error object
access:  public


Parameters:

string   $file   The file name of the file to attach OR the file contents itself
string   $c_type   The content type
string   $name   The filename of the attachment Only use if $file is the contents
bool   $isfile   Whether $file is a filename or not Defaults to true
string   $encoding   The type of encoding to use. Defaults to base64. Possible values: 7bit, 8bit, base64, or quoted-printable.
string   $disposition   The content-disposition of this file Defaults to attachment. Possible values: attachment, inline.
string   $charset   The character set used in the filename of this attachment.
string   $language   The language of the attachment
string   $location   The RFC 2557.4 location of the attachment

[ Top ]

method addBcc [line 873]

void addBcc( string $email)

Add an email to the Bcc (blank carbon copy) header (multiple calls to this method are allowed)



Tags:

access:  public


Parameters:

string   $email   The email direction to add

[ Top ]

method addCc [line 855]

void addCc( string $email)

Add an email to the Cc (carbon copy) header (multiple calls to this method are allowed)



Tags:

access:  public


Parameters:

string   $email   The email direction to add

[ Top ]

method addHTMLImage [line 283]

bool addHTMLImage( string $file, [string $c_type = 'application/octet-stream'], [string $name = ''], [bool $isfile = true])

Adds an image to the list of embedded images.



Tags:

return:  true on success
access:  public


Parameters:

string   $file   the image file name OR image data itself
string   $c_type   the content type
string   $name   the filename of the image. Only used if $file is the image data.
bool   $isfile   whether $file is a filename or not. Defaults to true

[ Top ]

method encodeRecipients [line 895]

string encodeRecipients( string $recipients)

Since the PHP send function requires you to specifiy recipients (To: header) separately from the other headers, the To: header is not properly encoded.

To fix this, you can use this public method to encode your recipients before sending to the send function




Tags:

return:  Encoded data
access:  public


Parameters:

string   $recipients   A comma-delimited list of recipients

[ Top ]

method get [line 634]

string &get( [array $build_params = null])

Builds the multipart message from the list ($this->_parts) and returns the mime content.



Tags:

return:  The mime content
access:  public


Parameters:

array   $build_params   Build parameters that change the way the email is built. Should be associative. Can contain: head_encoding - What encoding to use for the headers. Options: quoted-printable or base64 Default is quoted-printable text_encoding - What encoding to use for plain text Options: 7bit, 8bit, base64, or quoted-printable Default is 7bit html_encoding - What encoding to use for html Options: 7bit, 8bit, base64, or quoted-printable Default is quoted-printable 7bit_wrap - Number of characters before text is wrapped in 7bit encoding Default is 998 html_charset - The character set to use for html. Default is iso-8859-1 text_charset - The character set to use for text. Default is iso-8859-1 head_charset - The character set to use for headers. Default is iso-8859-1

[ Top ]

method getMessage [line 587]

string getMessage( [string $separation = null], [array $build_params = null], [array $xtra_headers = null], [bool $overwrite = false])

Returns the complete e-mail, ready to send using an alternative

mail delivery method. Note that only the mailpart that is made with Mail_Mime is created. This means that, YOU WILL HAVE NO TO: HEADERS UNLESS YOU SET IT YOURSELF using the $xtra_headers parameter!




Tags:

return:  The complete e-mail.
access:  public


Parameters:

string   $separation   The separation etween these two parts.
array   $build_params   The Build parameters passed to the &get() function. See &get for more info.
array   $xtra_headers   The extra headers that should be passed to the &headers() function. See that function for more info.
bool   $overwrite   Overwrite the existing headers with new.

[ Top ]

method headers [line 780]

array &headers( [array $xtra_headers = null], [bool $overwrite = false])

Returns an array with the headers needed to prepend to the email (MIME-Version and Content-Type). Format of argument is: $array['header-name'] = 'header-value';



Tags:

return:  Assoc array with the mime headers
access:  public


Parameters:

array   $xtra_headers   Assoc array with any extra headers. Optional.
bool   $overwrite   Overwrite already existing headers.

[ Top ]

method setFrom [line 841]

void setFrom( string $email)

Set an email to the From (the sender) header



Tags:

access:  public


Parameters:

string   $email   The email address to use

[ Top ]

method setHTMLBody [line 255]

bool setHTMLBody( string $data, [bool $isfile = false])

Adds a html part to the mail.



Tags:

return:  true on success
access:  public


Parameters:

string   $data   either a string or the file name with the contents
bool   $isfile   a flag that determines whether $data is a filename, or a string(false, default)

[ Top ]

method setSubject [line 828]

void setSubject( string $subject)

Sets the Subject header



Tags:

access:  public


Parameters:

string   $subject   String to set the subject to.

[ Top ]

method setTXTBody [line 222]

mixed setTXTBody( string $data, [bool $isfile = false], [bool $append = false])

Accessor function to set the body text. Body text is used if it's not an html mail being sent or else is used to fill the text/plain part that emails clients who don't support html should show.



Tags:

return:  true on success or PEAR_Error object
access:  public


Parameters:

string   $data   Either a string or the file name with the contents
bool   $isfile   If true the first param should be treated as a file name, else as a string (default)
bool   $append   If true the text or file is appended to the existing body, else the old body is overwritten

[ Top ]

method txtHeaders [line 809]

string txtHeaders( [array $xtra_headers = null], [bool $overwrite = false])

Get the text version of the headers (usefull if you want to use the PHP mail() function)



Tags:

return:  Plain text headers
access:  public


Parameters:

array   $xtra_headers   Assoc array with any extra headers. Optional.
bool   $overwrite   Overwrite the existing heaers with new.

[ Top ]


Documentation generated on Sun, 08 Jan 2012 17:51:54 +0100 by phpDocumentor 1.4.3