Public Member Functions | |
__construct () | |
setTemplateVar ($var, $value=null) | |
getTemplateVars () | |
getBody () | |
getSubject () | |
send () | |
Protected Attributes | |
$_tplVars = array() | |
$_block |
Definition at line 39 of file Email.php.
__construct | ( | ) |
Constructor
By default is looking for first argument as array and assignes it as object attributes This behaviour may change in child classes
Reimplemented from Varien_Object.
Definition at line 44 of file Email.php.
00045 { 00046 // TODO: move to config 00047 $this->setFromName('Magento'); 00048 $this->setFromEmail('magento@varien.com'); 00049 $this->setType('text'); 00050 }
getBody | ( | ) |
Definition at line 70 of file Email.php.
00071 { 00072 $body = $this->getData('body'); 00073 if (empty($body) && $this->getTemplate()) { 00074 $this->_block = Mage::getModel('core/layout')->createBlock('core/template', 'email') 00075 ->setArea('frontend') 00076 ->setTemplate($this->getTemplate()); 00077 foreach ($this->getTemplateVars() as $var=>$value) { 00078 $this->_block->assign($var, $value); 00079 } 00080 $this->_block->assign('_type', strtolower($this->getType())) 00081 ->assign('_section', 'body'); 00082 $body = $this->_block->toHtml(); 00083 } 00084 return $body; 00085 }
getSubject | ( | ) |
getTemplateVars | ( | ) |
send | ( | ) |
Definition at line 97 of file Email.php.
00098 { 00099 if (Mage::getStoreConfigFlag('system/smtp/disable')) { 00100 return $this; 00101 } 00102 00103 $mail = new Zend_Mail(); 00104 00105 if (strtolower($this->getType()) == 'html') { 00106 $mail->setBodyHtml($this->getBody()); 00107 } 00108 else { 00109 $mail->setBodyText($this->getBody()); 00110 } 00111 00112 $mail->setFrom($this->getFromEmail(), $this->getFromName()) 00113 ->addTo($this->getToEmail(), $this->getToName()) 00114 ->setSubject($this->getSubject()); 00115 $mail->send(); 00116 00117 return $this; 00118 }
setTemplateVar | ( | $ | var, | |
$ | value = null | |||
) |