Agile Toolkit  4.2
Agile Toolkit is a powerful web development framework. Inspired by GUI Applications development
TMail_Compat Class Reference
Inheritance diagram for TMail_Compat:
AbstractController AbstractObject

Public Member Functions

 init ()
 reset ()
 loadTemplate ($template, $type='.txt')
 setTag ($tag, $value=null)
 setIsHtml ($is_html=true)
 setBodyType ($type)
 set ($tag, $value)
 setHeader ($name, $value=null)
 getTemplateEngine ()
 loadDefaultTemplate ()
 getBody ()
 getSign ()
 getHeaders ()
 getBoundary ()
 get ($tag, $plain=true)
 setBody ($body)
 attachFile ($file, $type, $name=null, $asstring=false)
 attachHTML ($html)
 attachText ($text)
 getFromAddr ()
 send ($address, $add_params=null)

Data Fields

 $version = '1.0'

Protected Attributes

 $headers = array()
 $mime = array()
 $plain_text = "Sorry, this message can only be read with MIME-supporting mail reader.\n\n"
 $boundary = null
 $template = null
 $attrs = array()
 $body_type = 'text'

Detailed Description

Class for mail rendering and sending. This class is designed to be based on mail templates. Usually you set all the mail parameters such as from, to, bcc, subject and so on in the mail template, so in order to send the mail you should do the following:

$mail=$this->add('TMail')->loadTemplate('your_template')->send($to_address);

However, you can redefine all the email parts after template load.

$mail->loadTemplate('mail/template'); $mail->body="This is test e-mail"; $mail->send('somewhere@somehost.net');

Or you can set the tags of the templates:

$mail->body->setTag('server_name',$server_name);

This method will set specified tag in all the message parts: subject, body, sign

Multipart MIME messages are also supported. You can add attachments, as well as add text and HTML part: $mail ->setBodyType('both') // use both HTML and text part ->setBody($html) // default body is HTML for 'both' message type ->attachText($text); // adding text part for plain-text mode

For non MIME compatible mail readers plain text part is also added. Content of this part depends on message type:

  • text and both types: text part content
  • html type: explanation message (see getBody() method for details)

Created on 15.03.2007 by *Camper* (camper@adevel.com) Changed on 08.04.2008 by *Camper* (camper@adevel.com)


Member Function Documentation

attachFile ( file,
type,
name = null,
asstring = false 
)

Attaches a saved file

Parameters:
$fileany valid path to a file
$typevalid mime type. e.g.: audio/mpeg image/jpeg application/zip audio/wav etc.
$nameoptional, sets the filename for message
$asstringif set to true, $file contains contents, not filename
attachHTML ( html)

Attaches a provided HTML string as a HTML file

Parameters:
$htmlany valid HTML code as a string
attachText ( text)
get ( tag,
plain = true 
)
getBody ( )

Returns the rendered mail body, sign included

getSign ( )
init ( )

Initialize object. Always call parent

This method is called for initialization

Reimplemented from AbstractObject.

Loads default template and sets sign and headers from it

loadTemplate ( template,
type = '.txt' 
)
reset ( )
send ( address,
add_params = null 
)

Does the actual send by calling mail() function

set ( tag,
value 
)

Sets the mail attribute

setBody ( body)

Sets the body of the message. Behaviour of this method depends on the body type specified with setBodyType():

  • text: plain text mime part is set
  • html: html mime part only is set
  • both: html mime part only is set, text part should be added separately

This method does NOT accept SMlite object as a parameter.

setBodyType ( type)

Sets the body type. Possible values:

  • text: plain text
  • html: HTML only
  • both: text and HTML
setHeader ( name,
value = null 
)
setIsHtml ( is_html = true)
setTag ( tag,
value = null 
)

Sets the tag value throughout the template, including all parts Some parts could be strings, not templates


Field Documentation

$attrs = array() [protected]
$body_type = 'text' [protected]
$boundary = null [protected]
$headers = array() [protected]
$mime = array() [protected]
$plain_text = "Sorry, this message can only be read with MIME-supporting mail reader.\n\n" [protected]
$template = null [protected]
$version = '1.0'

The documentation for this class was generated from the following file:
 All Data Structures Files Functions Variables Enumerations