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('
');
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* (
attachText()
public method
Returns the rendered mail body, sign included.
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()
public method
Sets the body type. Possible values:
- text: plain text
- html: HTML only
- both: text and HTML.
$body protected_oe property
$body_type protected_oe property
$plain_text protected_oe property