使用Symfony2邮寄

My exercise is to create mailing system with Symfony2.

  • for 10 000 persons
  • every email must have person name
  • secretary create message, click send and after minute want to turn off computer
  • 1 second after send was clicked secretary must get feedback "Sending emails"
  • emails sending must work in background

Is Process component good for this job?

Could somebody give me any hint about solving this problem?

What I think is to after click send (AJAX):

  • check if SMTP server is working
  • store in db secretary message
  • after displayng message, send another request for sending previous stored message
  • set max time limit to 0
  • use SwiftMailer to send those 10 000 emails

or

  • use PHP exec function to launch external script to send those emails write in e.g. Python

What do you think?

The way i would do that is to use the Spool Email function:

http://symfony.com/doc/master/cookbook/email/spool.html

using this script

php app/console swiftmailer:spool:send --env=prod

So you can for example, after calling mail creation script:

  • Usee ajax to call another php script that run that command
  • Setup cron job to that script
  • Run a python script that parses the spool file and sends email

I would do the second one, so you just spool all those mails quickly and the sending process is leaved to the system.