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

Class: Mail_mime

Source Location: /modules/Apps/MailClient/PEAR/Mail/mime.php

Class Mail_mime

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.

Located in /modules/Apps/MailClient/PEAR/Mail/mime.php [line 94]



		
				Author(s):
		
		
		
Information Tags:
Version:  Release: @package_version@
Copyright:  2003-2006 PEAR <pear-group@php.net>
Link:  http://pear.php.net/package/Mail_mime
License:  BSD License

Methods

[ Top ]
Method Summary
void   Mail_mime()   Constructor function.
mixed   addAttachment()   Adds a file to the list of attachments.
void   addBcc()   Add an email to the Bcc (blank carbon copy) header (multiple calls to this method are allowed)
void   addCc()   Add an email to the Cc (carbon copy) header (multiple calls to this method are allowed)
bool   addHTMLImage()   Adds an image to the list of embedded images.
string   encodeRecipients()   Since the PHP send function requires you to specifiy recipients (To: header) separately from the other headers, the To: header is not properly encoded.
string   &get()   Builds the multipart message from the list ($this->_parts) and returns the mime content.
string   getMessage()   Returns the complete e-mail, ready to send using an alternative
array   &headers()   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';
void   setFrom()   Set an email to the From (the sender) header
bool   setHTMLBody()   Adds a html part to the mail.
void   setSubject()   Sets the Subject header
mixed   setTXTBody()   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.
string   txtHeaders()   Get the text version of the headers (usefull if you want to use the PHP mail() function)

[ Top ]
Methods
Constructor Mail_mime  [line 179]

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

Constructor function.

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

API Tags:
Access:  public


[ Top ]
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.

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

API Tags:
Return:  true on success or PEAR_Error object
Access:  public


[ Top ]
addBcc  [line 873]

  void addBcc( string $email  )

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

Parameters:
string   $email:  The email direction to add

API Tags:
Access:  public


[ Top ]
addCc  [line 855]

  void addCc( string $email  )

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

Parameters:
string   $email:  The email direction to add

API Tags:
Access:  public


[ Top ]
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.

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

API Tags:
Return:  true on success
Access:  public


[ Top ]
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

Parameters:
string   $recipients:  A comma-delimited list of recipients

API Tags:
Return:  Encoded data
Access:  public


[ Top ]
get  [line 634]

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

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

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

API Tags:
Return:  The mime content
Access:  public


[ Top ]
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!

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.

API Tags:
Return:  The complete e-mail.
Access:  public


[ Top ]
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';

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

API Tags:
Return:  Assoc array with the mime headers
Access:  public


[ Top ]
setFrom  [line 841]

  void setFrom( string $email  )

Set an email to the From (the sender) header

Parameters:
string   $email:  The email address to use

API Tags:
Access:  public


[ Top ]
setHTMLBody  [line 255]

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

Adds a html part to the mail.

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)

API Tags:
Return:  true on success
Access:  public


[ Top ]
setSubject  [line 828]

  void setSubject( string $subject  )

Sets the Subject header

Parameters:
string   $subject:  String to set the subject to.

API Tags:
Access:  public


[ Top ]
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.

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

API Tags:
Return:  true on success or PEAR_Error object
Access:  public


[ Top ]
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)

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

API Tags:
Return:  Plain text headers
Access:  public


[ Top ]

Documentation generated on Fri, 26 Dec 2008 21:43:58 -0500 by phpDocumentor 1.4.2