Send mail without blocking 'execution'

前端 未结 4 675
刺人心
刺人心 2021-01-15 06:36

I\'m using Zend_Mail in a Zend Framework application to send an e-mail with the contents of a web-based contact form.

The mailing itself works fine ( im using a Goog

4条回答
  •  野的像风
    2021-01-15 07:08

    I would like to suggest to use cron jobs , its relatively easy , stable , and simply fits you

    here some links about ZF + cronjobs :

    1. How do you store your scripts for cron jobs in Zend Framework?
    2. http://www.god-object.com/2010/03/26/bootstrap-zend-framework-for-use-in-cronjobs/
    3. http://jazzslider.org/2010/01/12/cron-tasks-in-zend-framework-apps
    4. Create cronjob with Zend Framework >>

    After some research and a lot procrastination I came to the simple conclusion that a ZF-ized cron script should contain all the functionality of you zend framework app - without all the view stuff. I accomplished this by creating a new cronjobfoo.php file in my application directory. Then I took the bare minimum from: -my front controller (index.php) -my bootstrap.php

    I took out all the view stuff and focused on keeping the environment setup, db setup, autoloader, & registry setup. I had to take a little time to correct the document root variable and remove some of the OO functionality copied from my bootstrap.

    After that I just coded away.. in my case it was compiling and emailing out nightly reports. It was great to use Zend_Mail. When I was confident that my script was working the way I wanted, I just added it my crontab.

    Goodluck !

提交回复
热议问题