php mail messages to sendmail taking much too long

In order to prevent any php processes on our web server from waiting
  for sendmail hangups (name resolution issues, etc), we wrap sendmail
  in a simple shell script and push it to the background and disown the
  process so that any php script on our site can continue on processing
  code and not have to wait for sendmail to return.
   
  So, in php.ini we have the following setting:
   
  sendmail_path = "/usr/local/bin/phpsendmail.sh -t -i"
   
  and in phpsendmail.sh we have the following:
   
  #!/bin/bash
  cat /dev/stdin | /usr/bin/sendmail "$@" & 
   
   
   
   
  The problem we are encountering is that it seems to take quite a while
  (in computer time) for a lengthy (50K) text email to actually get
  piped into sendmail this way.  When a script pushes out 20 emails of
  this size, we are seeing it take approximately 20-25 seconds. We have
  some background processes that need to send batched email from a
  database table (for immediate delivery, not queued) and we would like
  to speed the process up, while still using this concept of pushing
  each sendmail process out to the background.  What can we do to speed
  up the process of piping this information through the wrapper script
  and into the sendmail process?
   
dave_mwiAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

TheMaximumWeaselCommented:
I use postfix and it seems to work a lot faster and it processes a lot fast so you don't have to push it into the background so then you lose the delay of email. Also if this is a personal site that you host yourself in the postfix config you can put relayhost = smtp.yourisp.com and it will relay the email to your isp which makes sending out a lot faster and less is marked as spam.


Max

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.