cvs: peardoc /en/package/mail/mail-queue/mail-queue tutorial.xml

From: Date: Fri, 12 Mar 2004 10:01:32 +0000
Subject: cvs: peardoc /en/package/mail/mail-queue/mail-queue tutorial.xml
Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-2947@lists.php.net to get a copy of this message
quipo Fri Mar 12 05:01:32 2004 EDT Modified files: /peardoc/en/package/mail/mail-queue/mail-queue tutorial.xml Log: - add another example http://cvs.php.net/diff.php/peardoc/en/package/mail/mail-queue/mail-queue/tutorial.xml?r1=1.2&r2=1.3&ty=u Index: peardoc/en/package/mail/mail-queue/mail-queue/tutorial.xml diff -u peardoc/en/package/mail/mail-queue/mail-queue/tutorial.xml:1.2 peardoc/en/package/mail/mail-queue/mail-queue/tutorial.xml:1.3 --- peardoc/en/package/mail/mail-queue/mail-queue/tutorial.xml:1.2 Mon Mar 8 06:21:54 2004 +++ peardoc/en/package/mail/mail-queue/mail-queue/tutorial.xml Fri Mar 12 05:01:32 2004 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry id="package.mail.mail-queue.mail-queue.tutorial"> <refnamediv> <refname>Tutorial</refname> @@ -74,7 +74,7 @@ <title /> <para> First you need to define some options. -As you need them two times (once for adding messages, once for sending the messages) +As you need them two times (once for adding messages, once for sending the messages) its always good to add them to a config-file. Lets call it config.php </para> </refsect1> @@ -99,7 +99,7 @@ $db_options['mail_table'] = 'mail_queue'; // here are the options for sending the messages themselves -// these are the options needed for the Mail-Class, especially used for Mail::factory() +// these are the options needed for the Mail-Class, especially used for Mail::factory() $mail_options['driver'] = 'smtp'; $mail_options['host'] = 'your_server_smtp.com'; $mail_options['port'] = 25; @@ -169,7 +169,7 @@ <refsect1 id="package.mail.mail-queue.mail-queue.tutorial.part7"> <title /> <para> -Ok, now we've used the simple way to add a message ... there are more advanced options, please check +Ok, now we've used the simple way to add a message ... there are more advanced options, please check docs of the put-function for these. Now we need to send the messages. This is most often done by using a cron-job which regularly runs @@ -208,11 +208,54 @@ <refsect1 id="package.mail.mail-queue.mail-queue.tutorial.part9"> <title /> <para> -We are done. +We are done. Now run the last script regularly and add your mails to the queue as needed. </para> </refsect1> +<refsect1 id="package.mail.mail-queue.mail-queue.tutorial.part10"> +<title /> +<para> +Since <classname>Mail_Queue</classname> v.1.1, the <function>preload</function> +method doesn't preload ALL the mails in memory, but just a few of them each time. +When the buffer is empty, it is filled again automatically. You can set the size +of the buffer via the new <function>setBufferSize</function> method. +</para> +</refsect1> + +<refsect1 id="package.mail.mail-queue.mail-queue.tutorial.part11"> +<title /> +<para> +You can also send the stored emails one by one. +Here is a simple script to achieve this: +</para> +</refsect1> + +<refsect1 id="package.mail.mail-queue.mail-queue.tutorial.part12"> +<title /> + <example> + <title>send_messages_one_by_one.php</title> + <programlisting role="php"> +<![CDATA[ +<?php +//set the internal buffer size according your +//memory resources (the number indicates how +//many emails can stay in the buffer at any +//given time + +$mail_queue->setBufferSize(20); + +//loop through the stored emails and send them +while ($mail = $mail_queue->get()) { + $result = $mail_queue->sendMail($mail); +} +?> +]]> + +</programlisting> +</example> +</refsect1> + </refentry> <!-- Keep this comment at the end of the file

« previous php.pear.doc (#2947) next »