Use {@link view} and {@link setBody()} for more control.
/** * Construct * @param string $subject * @param string[] $body * @param string $contentType * @param string $charset */ public function __construct($subject = null, $body = null, $contentType = 'text/html', $charset = null) { parent::__construct($subject, $body, $contentType, $charset); Yii::app()->name = str_replace($this->removeSubjectWord, '', Yii::app()->name); $this->subjectPrefix = sprintf('[%s] %s | ', preg_replace('/^(https?:\\/\\/)|(www.)/is', '', Yii::app()->getBaseUrl(true)), Yii::app()->name); if ($this->message && !count($this->message->getFrom())) { $this->setFrom($this->emailNoReply()); } }