想要在后台php中发送电子邮件


want to send email in back ground in php

最近我正在研究symfony。我已经创建了一个简单的表单,并希望提交该表单并以电子邮件的形式向用户发送回复。

index中,我写了如下:

    $product=new Product();
    $product->setName('rohit');
    $product->setPass('rohit');
    $form=$this->createFormBuilder($product)
    ->add('name','text')
    ->add('pass','password')
    ->getForm();
    $name='rohit';
        return $this->render('EnsNewBundle:Email:ind.html.twig',
    array('form'=>$form->createView(),'name'=>$name));

当我提交这份表格时,应该执行以下操作:

i) 它应该打印CCD_ 2并且ii)电子邮件流程应在后台运行。

我试着写如下:

$client = new 'Predis'Client();
      $client->lpush('emailid','ucerturohit@gmail.com');
      $u=$client->lrange('emailid',0,10);
  //notification_on_signup($u);
     var_dump($u);
    return $this->render('EnsNewBundle:Email:header.html.twig');

我应该在其中更正什么才能有效运行

创建一个单独的PHP脚本来完成后台工作,并在主脚本中调用该脚本。关键是&amp符号!

<?php
$command = "/usr/bin/php5 -f /var/www/my/php/file.php";
exec( "$command > /dev/null &", $arrOutput );
?>