public function actionForgot() { $message = ""; // TODO: Sanitize input!!! if (isset($_POST['email'])) { $email = $_POST['email']; // TODO: See if user's email address exists in database $customer = Customer::model()->findByAttributes(array('bilemail' => $email)); if ($customer != null) { // Send user's password to client $message = new YiiMailMessage(); $message->view = 'template'; $message->setBody(array('include' => 'forgot-password.php', 'customer' => $customer), 'text/html'); $message->addTo($customer->bilemail); $message->addBcc("*****@*****.**"); $message->addFrom(Yii::app()->params['adminEmail']); $message->setSubject("Password Request"); Yii::app()->mail->send($message); $message = "Email sent."; } else { $message = "Email address not found."; } } $this->render('forgotpassword', array('message' => $message)); }
/** * */ public function actionSendStatement($id) { // Look up customer information $customer = Customer::model()->findByPk($id); $commande = Commande::model()->findAllByAttributes(array('bilkey' => $id)); $service_details = Customer::model()->getCustomerServiceDetails($id); $shipment_details = Customer::model()->getShipmentsByCustomerBilkeyClient($id); // TODO: Make sure these are correct $message = new YiiMailMessage(); $message->view = 'template'; //userModel is passed to the view $message->setBody(array('include' => 'statement.php', 'customer' => $customer, 'commande' => $commande, 'service_details' => $service_details, 'shipment_details' => $shipment_details), 'text/html'); $message->addTo($customer->bilemail); $message->addFrom(Yii::app()->params['adminEmail']); $message->setSubject("Statement of Account"); Yii::app()->mail->send($message); $this->redirect(array('update', 'id' => $id)); }