예제 #1
0
 /**
  * Executes index action
  *
  */
 public function executeIndex()
 {
     $u_id = sfContext::getInstance()->getUser()->getAttribute('subscriber_id', '-1', 'subscriber');
     if ($u_id <= 0) {
         $this->subscribe = null;
         if ($this->getRequest()->getMethod() == sfRequest::POST) {
             try {
                 $newUser = $this->getRequestParameter('email');
                 $this->subscribe = 'Thanks, we will contact you shortly at the email address you have provided';
                 /*$connection = new Swift_Connection_SMTP('smtp.gmail.com', 465, Swift_Connection_SMTP::ENC_SSL);
                           $connection->setUsername('*****@*****.**');
                           $connection->setPassword('bRb061626');
                 
                           $mailer = new Swift($connection);
                           $message = new Swift_Message('USER REQUEST-'.$email);
                 
                           // Send
                           $mailer->send($message, '*****@*****.**', '*****@*****.**');
                           $mailer->disconnect();
                         */
                 $email = new CycleBrainEmail();
                 $email->sendEmail('*****@*****.**', '*****@*****.**', 'BETA USER', $newUser);
             } catch (Exception $e) {
                 echo 'MainActions:Index Caught exception: ', $e->getMessage(), "\n";
             }
         }
     } else {
         $this->user = UsersPeer::retrieveByPK($u_id);
     }
 }
예제 #2
0
 public function sendMail($user, $link, $userId, $to)
 {
     try {
         // Create the mailer and message objects
         /*  $connection = new Swift_Connection_SMTP('smtp.gmail.com', 465, Swift_Connection_SMTP::ENC_SSL);
                   $connection->setUsername('*****@*****.**');
                   $connection->setPassword('bRb061626');
         
                   $mailer = new Swift($connection);
                   $message = new Swift_Message('Welcome to CycleBrain');*/
         $fullLink = 'http://test.brandon.com/frontend_dev.php/confirmation?uid=' . $userId . '&conf=' . $link;
         $email = new CycleBrainEmail();
         $subject = 'Welcome to Cyclebrain';
         $body = $userId . ' Please follow the link below to activate your account\\n' . $fullLink;
         $email->sendEmail($to, '*****@*****.**', $subject, $body);
         // Render message parts
         /* $mailContext = array('name' => $user,'link' => $fullLink);
                   $message->attach(new Swift_Message_Part($this->getPartial('users/mailHtmlBody', $mailContext), 'text/html'));
                   $message->attach(new Swift_Message_Part($this->getPartial('users/mailTextBody', $mailContext), 'text/plain'));
         
                   // Send
                   $mailer->send($message, $email, '*****@*****.**');
                   $mailer->disconnect();*/
     } catch (Exception $e) {
         //$mailer->disconnect();
     }
 }