开发者

how to email form on submit using zend_form?

OK. I finally got my zend form working, validating, filtering and sending the contents to my process page (by using $form->populate($formData);)

Now, how do I email myself the contents of a form when submitted? Is this a part of Zend_form or some 开发者_开发百科other area I need to be looking in?

Thanks!


You can use Zend Mail for this, Zend form does not offer such functions.. but its an nice idea.

In your controleller, after $form->isValid();

if ($form->isValid($_POST)) {
 $mail = new Zend_Mail();
 $values = $form->getValues();
 $mailText = 'My form valueS: ';

  foreach ($values as $v) {
    $mailText .= 'Value ' . $v . PHP_EOL;
      }

 $mail->setFrom('user@user.de', 'user');
 $mail->AddTo('Me@me.de', 'me');
 $mail->setSubject->$form->getName();
 $mail->send();
} else {
    // what ever
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜