By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,985 Members | 2,907 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,985 IT Pros & Developers. It's quick & easy.

Newsletter script in PHP

P: n/a
Hello,

I have programmed an application to manage newsletters in PHP. I send the
mails using smtp, but when there are more than 500 subscribers and when the
mails (in html) are too big, it is really slow.

What can I do gain speed ?

Thanks,

Nicolas
Jul 17 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
"Nicolas" <ni*******@SPAMlomitko.com> wrote in message
news:bo***********@biggoron.nerim.net...
Hello,

I have programmed an application to manage newsletters in PHP. I send the
mails using smtp, but when there are more than 500 subscribers and when the mails (in html) are too big, it is really slow.

What can I do gain speed ?


Have you looked at using phpMailer? It's a very good mail handling class for
PHP that's completely free but has a lot of built-in functionality for
handling large quantities of mail. I've never used it for sending those
sorts of quantities of mail but there are plenty of other projects out there
using it so I'm sure the answer lies within somehow.
Jul 17 '05 #2

P: n/a
> Have you looked at using phpMailer? It's a very good mail handling class
for
PHP that's completely free but has a lot of built-in functionality for
handling large quantities of mail.


I'll try it, to see how fast it can be...

Thanks

Nicolas
Jul 17 '05 #3

P: n/a
Also, when you're using php's mail function or phpmailer, it is preferable
(from a speed perspective) to call the sent function once with a big to-list
rather than call the send function multiple times within a loop.

Doing the latter will open and close your connection to the mail server
slowing things down considerably.

Doing it once will mean that you lose the personalisation options (Dear
$Firstname $Lastname), but I guess this might be acceptable is your
preference is for speed.

Also, for phpmailer (which I also highly recommend), see the performance
questions in the FAQ here for more tips:
http://phpmailer.sourceforge.net/faq.html#faq4
"Nicolas" <ni*******@SPAMlomitko.com> wrote in message
news:bo***********@biggoron.nerim.net...
Have you looked at using phpMailer? It's a very good mail handling class for PHP that's completely free but has a lot of built-in functionality for
handling large quantities of mail.


I'll try it, to see how fast it can be...

Thanks

Nicolas

Jul 17 '05 #4

P: n/a
> Also, when you're using php's mail function or phpmailer, it is preferable
(from a speed perspective) to call the sent function once with a big to-list rather than call the send function multiple times within a loop.
I considered this solution (with bcc instead of to) but I need some
personalisation (see below).
Doing the latter will open and close your connection to the mail server
slowing things down considerably.

Doing it once will mean that you lose the personalisation options (Dear
$Firstname $Lastname), but I guess this might be acceptable is your
preference is for speed.
Actually, I don't need personalisations like dear $firstname $lastname, but
in my application, each subscriber gets an id and a key which allows him to
unsubscribe from the newsletter. And I need to send that key with the
newsletter in order to know that the user asking to unsubscribe is really
himself.

Otherwise he would send an unsubscribe request, receive a mail to confirm,
and then be unsubuscribed when the application received the confirmation,
which is a little heavy.
Also, for phpmailer (which I also highly recommend), see the performance
questions in the FAQ here for more tips:
http://phpmailer.sourceforge.net/faq.html#faq4


I'll have a look at that link

Thanks a lot

Nicolas
Jul 17 '05 #5

P: n/a
Hello,

On 11/13/2003 07:47 AM, Nicolas wrote:
I have programmed an application to manage newsletters in PHP. I send the
mails using smtp, but when there are more than 500 subscribers and when the
mails (in html) are too big, it is really slow.

What can I do gain speed ?


Sending mailings via SMTP is the slowest method of all because you need
to establish an TCP connection with a relay server which just injects
the messages in the queue to be resent again.

If you have a local mailer in your machine like
sendmail/qmail/postfix/etc... it is better to invoke the local mailer
program which is just what the mail() function does under Linux/Unix.

Depending on the type of local mailer that you use, you can try to
optimize the queue injection further for mass mailing, using the right
switches.

In that case you may want to try this class for composing and sending
messages that comes with sub-classes specialized in the delivery of
messages with different local mailers.

The class also makes it easy to compose messages in HTML properly
according to the RFC recommendations. If your message bodies do need to
be personalized for each user, the class can optimize the message
composing further.

http://www.phpclasses.org/mimemessage

--

Regards,
Manuel Lemos

Free ready to use OOP components written in PHP
http://www.phpclasses.org/

Jul 17 '05 #6

P: n/a
Hello,

On 11/13/2003 07:47 AM, Nicolas wrote:
I have programmed an application to manage newsletters in PHP. I send the
mails using smtp, but when there are more than 500 subscribers and when the
mails (in html) are too big, it is really slow.

What can I do gain speed ?


Sending mailings via SMTP is the slowest method of all because you need
to establish an TCP connection with a relay server which just injects
the messages in the queue to be resent again.

If you have a local mailer in your machine like
sendmail/qmail/postfix/etc... it is better to invoke the local mailer
program which is just what the mail() function does under Linux/Unix.

Depending on the type of local mailer that you use, you can try to
optimize the queue injection further for mass mailing, using the right
switches.

In that case you may want to try this class for composing and sending
messages that comes with sub-classes specialized in the delivery of
messages with different local mailers.

The class also makes it easy to compose messages in HTML properly
according to the RFC recommendations. If your message bodies do need to
be personalized for each user, the class can optimize the message
composing further.

http://www.phpclasses.org/mimemessage

--

Regards,
Manuel Lemos

Free ready to use OOP components written in PHP
http://www.phpclasses.org/

Jul 17 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.