Re: Mail Function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, July 19, 2005 4:31 pm, Cabbar Duzayak said:
> I have a web site that is going to have around total of 10-20 thousand
> unique users, about 1000 unique hits per day on shared hosting.
>
> I have been using PHP's internal mail mechanism with the local smtp
> server on my hosting company, but it is more like a hit-and-miss kind
> of thing. And, there are users complaining that they are not getting
> any e-mail.

I think there are several things to look at here...

First and foremost:  When you say "PHP's internal mail mechanism with the
local smtp server" I'm not sure what you mean.

If you use http://php.net/mail then you are invoking the sendmail (or
qmail or postfix or whatever) program on *EACH* and *EVERY* email you
attempt to send out.

sendmail (or qmail or postfix or whatever) are *NOT* small programs.

If you are sending out a *LOT* of email, this is going to fail miserably,
because you are simply trying to run TOO MANY processes on the box.

In theory, PHP would return FALSE when it failed, and you could just keep
calling mail() with the same args until it "worked" but this is incredibly
inefficient.

You should probably investigate using the Mail class at
http://phpclasses.org or something similar that will let you open *ONE*
SMTP connection and then you can churn out email after email through that
one connection.  *MUCH* more efficient than firing up sendmail (or
equivalent) for every piece of eamil to go out.

The other thing to investigate is the users' spam filtering.  Odds are
pretty good your PHP email is getting tagged as spam by somebody
somewhere.

You can improve your odds by:
  Making it come "From: " a person with "First Last" <user@xxxxxxxxxxx>
instead of just user@xxxxxxxxxxx
  Use From, Reply-to and Return-Path headers, all the same.
  Don't send attachments or HTML enhanced (cough, cough) email.

> Can you guys please provide advise as to what the problem might be? I
> don't think it is the local SMTP, because the way SMTP is configured
> is pretty solid, and once you submit internally (not via port 25), it
> should retry till it delivers it. So, I am thinking it might be
> because of headers or something else.

If it's what I outlined initially above, you're not even getting as far as
submitting it internally.  The OS isn't letting PHP run 2,000 copies of
sendmail at once, and it shouldn't.

> So, should I use a more sophisticated mail library? Can you recommend any?

You'll have to understand what's going wrong now, no matter what mail
library you choose, or you won't know what options to set to configure
that more sophisticated email package.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux