PHP Class TMail_Compat, atk4

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('[email protected]'); 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* ([email protected]) Changed on 08.04.2008 by *Camper* ([email protected])
Inheritance: extends AbstractController
Show file Open project: atk4/atk4

Public Properties

Property Type Description
$version

Protected Properties

Property Type Description
$attrs
$body
$body_type
$boundary
$headers
$is_html
$mime
$plain_text
$sign
$template

Public Methods

Method Description
attachFile ( $file, $type, $name = null, $asstring = false ) Attaches a saved file.
attachHTML ( $html ) Attaches a provided HTML string as a HTML file.
attachText ( $text )
get ( $tag, $plain = true )
getBody ( ) Returns the rendered mail body, sign included.
getBoundary ( )
getFromAddr ( )
getHeaders ( )
getSign ( )
getTemplateEngine ( ) : SMlite
init ( )
loadDefaultTemplate ( )
loadTemplate ( $template, $type = '.txt' )
reset ( )
send ( $address, $add_params = null ) Does the actual send by calling mail() function.
set ( $tag, $value )
setBody ( $body ) Sets the body of the message.
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 )

Method Details

attachFile() public method

Attaches a saved file.
public attachFile ( $file, $type, $name = null, $asstring = false )
$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() public method

Attaches a provided HTML string as a HTML file.
public attachHTML ( $html )
$html any valid HTML code as a string

attachText() public method

public attachText ( $text )

get() public method

public get ( $tag, $plain = true )

getBody() public method

Returns the rendered mail body, sign included.
public getBody ( )

getBoundary() public method

public getBoundary ( )

getFromAddr() public method

public getFromAddr ( )

getHeaders() public method

public getHeaders ( )

getSign() public method

public getSign ( )

getTemplateEngine() public method

public getTemplateEngine ( ) : SMlite
return SMlite

init() public method

public init ( )

loadDefaultTemplate() public method

public loadDefaultTemplate ( )

loadTemplate() public method

public loadTemplate ( $template, $type = '.txt' )

reset() public method

public reset ( )

send() public method

Does the actual send by calling mail() function.
public send ( $address, $add_params = null )

set() public method

public set ( $tag, $value )

setBody() public method

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.
public setBody ( $body )

setBodyType() public method

Sets the body type. Possible values: - text: plain text - html: HTML only - both: text and HTML.
public setBodyType ( $type )

setHeader() public method

public setHeader ( $name, $value = null )

setIsHtml() public method

public setIsHtml ( $is_html = true )

setTag() public method

public setTag ( $tag, $value = null )

Property Details

$attrs protected property

protected $attrs

$body protected property

protected $body

$body_type protected property

protected $body_type

$boundary protected property

protected $boundary

$headers protected property

protected $headers

$is_html protected property

protected $is_html

$mime protected property

protected $mime

$plain_text protected property

protected $plain_text

$sign protected property

protected $sign

$template protected property

protected $template

$version public property

public $version