I have a .php page with the following code:
<html>
<head></head>
<body>
Hi <?php echo $user['first_name'].' '.$user['last_name']?>,
<br><br>
To reset your password, please go to the following page:
<br>
<?php
$url = Yii::app()->createAbsoluteUrl('user/reset/id/'. $key);
echo "<a href='{$url}'>{$url}</a>";
?>
<br>
Your password will be automatically reset, and a new password will be emailed to you.
</body>
I want to be able to put this inside a function I created in the Controller inside setBody() here:
public function emailAll($url)
{
$this->set_mail_settings();
$message = new YiiMailMessage;
$emails = Yii::app()->db->createCommand("SELECT group_concat(email) as em FROM persons WHERE party_id != 184")->queryRow();
$email_ids = explode(",",$emails["em"]);
$message->setBcc($email_ids);
$message->setBody('To view, click here: '.$url);
$message->subject = 'New Announcement Posted!';
$message->addTo('dcp@gmail.com');
$message->from = Yii::app()->params['adminEmail'];
Yii::app()->mail->send($message);
}
The URL link that I want inside the body is coded from the actionCreate() which is here:
$currentid = Yii::app()->db->createCommand("select id from content where id = (select max(id) from content)")->queryRow();
Yii::app()->session['announcement_message'] = 'You have successfully created an announcement.';
$url = Yii::app()->createAbsoluteUrl('announcement/view/id/'. $currentid["id"]);
$this->emailAll($url);
$this->redirect(array('view','id'=>$model->id));
I'm just now trying to figure out how I would send that .php page that has html inside into the setBody() along with $url I passed. Any help?