Agile Toolkit
4.2
Agile Toolkit is a powerful web development framework. Inspired by GUI Applications development
|
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' |
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:
Created on 15.03.2007 by *Camper* (camper@adevel.com) Changed on 08.04.2008 by *Camper* (camper@adevel.com)
attachFile | ( | $ | file, |
$ | type, | ||
$ | name = null , |
||
$ | asstring = false |
||
) |
Attaches a saved file
$file | any valid path to a file |
$type | valid mime type. e.g.: audio/mpeg image/jpeg application/zip audio/wav etc. |
$name | optional, sets the filename for message |
$asstring | if set to true, $file contains contents, not filename |
attachHTML | ( | $ | html | ) |
Attaches a provided HTML string as a HTML file
$html | any valid HTML code as a string |
attachText | ( | $ | text | ) |
get | ( | $ | tag, |
$ | plain = true |
||
) |
getBody | ( | ) |
Returns the rendered mail body, sign included
getBoundary | ( | ) |
getFromAddr | ( | ) |
getHeaders | ( | ) |
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():
This method does NOT accept SMlite object as a parameter.
setBodyType | ( | $ | type | ) |
Sets the body type. Possible values:
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
$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' |