hello every one


 I am trying to send mail its work to every 5 min to send email in user
account but one problem is there can you solve this problem ... problem is
that when i m sending mail its sleep for 5 min and this time i m trying to
viewing view detail of users but its not show .. sleep thread is working ...
i dont didint get any solution to slove this problem plz...help me .!!!

this is cod i m using in user_controller :



function sendmail()
    {
    set_time_limit(0);
    $secs = 2;
    for($i=0;$i<$secs;$i++) {
    $this->_sendNewUserMail( $this->User->id );
    echo "\n$secs\n";
    $secs += 1;
    sleep(300);
//    $this->redirect(array('action' => 'index'));
        }
    }

    function _sendNewUserMail($id) {
    $User = $this->User->read(null,$id);
    $list = $this->User->query("SELECT * FROM users ");
       $data = $this->User->find($id);
    $this->Email->bcc = array('[email protected]');
    $this->Email->subject = 'Welcome to our really cakephp thing';
    $this->Email->replyTo = '[email protected]';
    $this->Email->from = 'sandeep <[email protected]>';
    $this->Email->template = 'simple_message'; // note no '.ctp'
    //Send as 'html', 'text' or 'both' (default is 'text')
    $this->Email->sendAs = 'both'; // because we like to send pretty mail
    //Set view variables as normal
    $this->set('User', $User);
    //Do not pass any args to send()
    $this->Email->attachments = array( TMP . 'foo.doc','bar.doc' => TMP .
'some-temp-name');
       /* SMTP Options */
 /*  $this->Email->smtpOptions = array(
        'port'=>'25',
        'timeout'=>'30',
        'host' => 'https://www.gmail.com',
        'username'=>'[email protected]',
        'password'=>'48sammy168880',
        'client' => 'localhost'
   );
*/
    /* Set delivery method */
  //  $this->Email->delivery = 'smtp';

   foreach($list as $info)
    {
    $this->Email->to = $info['users']['name'];
    if ( $this->Email->send() ) {
                $this->Session->setFlash('Simple email sent');

            } else {
                $this->Session->setFlash('Simple email not sent');
            }
    }
     $this->Email->reset();
    /* Check for SMTP errors. */

    }

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to