[FX.php List] Mass Mailing Techniques (CODE Extract)

Scott Baetz sbaetz at soscs.net
Tue Mar 28 07:33:45 MST 2006


All,

Thanks for the response.  I have already executed the code without the
array, and in fact it performs without issue.  It appears that the mail
function is timing out - and I'm not too experienced with that
configuration.

That said, I'm very intrigued by the suggestion to use a FileMaker script
with img tags - although I'm a bit lost on the concept.  Perhaps you can
elaborate a bit - or provide a code sample.

For those interested - here is my code extract - aside from the actual
database call...

--- CODE BELOW ---

// Extract FM data

foreach( $fmORGMEMBERdata['data'] as $key => $orgMEMBERS) {  

	// Load array with only those individuals whom we have an email
	// address.  (Previously validated email addresses).

	if ((strlen($orgMEMBERS['OrgMemUSERDATA::email'][0])>0) & 

		// Part of our criteria for selection includes a 
		// check if the individuals title is within the
		// selection criteria, unless we've decided to send to
		// ALL members.

		(in_array($orgMEMBERS['title'][0],$roles) ||
in_array('ALL',$roles))) {
	
$emailADD[$mailCOUNT]=$orgMEMBERS['OrgMemUSERDATA::email'][0];
			$mailCOUNT++;
	}  // End of check
} // End of Array Load

// Now loop through the built array 
// and send.

for($j=0;$j < count($emailADD);$j++) {

mail($emailADD[$j], $subject, stripslashes($body), "From:
$from\nReply-To:me\nContent-Type: text/html");

// Output for display error checking only...
  print $j.". ".$emailADD[$j]."<br>";

} // End of MAILING

---- END OF CODE SNIPPET ----


Scott Baetz
sbaetz at soscs.net
(603) 490-9988
http://www.soscs.net
 

-----Original Message-----
From: fx.php_list-bounces at mail.iviking.org
[mailto:fx.php_list-bounces at mail.iviking.org] On Behalf Of
fx.php_list-request at mail.iviking.org
Sent: Monday, March 27, 2006 11:51 AM
To: fx.php_list at mail.iviking.org
Subject: FX.php_List Digest, Vol 20, Issue 29

Send FX.php_List mailing list submissions to
	fx.php_list at mail.iviking.org

To subscribe or unsubscribe via the World Wide Web, visit
	http://www.iviking.org/mailman/listinfo/fx.php_list
or, via email, send a message with subject or body 'help' to
	fx.php_list-request at mail.iviking.org

You can reach the person managing the list at
	fx.php_list-owner at mail.iviking.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of FX.php_List digest..."


Today's Topics:

   1. Re: Subject:  Mass Mailing Techniques (Steve Hannah)
   2. Re: Subject:  Mass Mailing Techniques (DC)
   3. Re: Subject:  Mass Mailing Techniques (Dale Bengston)
   4. Re: FMSkipRecords (Dale Bengston)
   5. Re: FMSkipRecords (Chris Hansen)


----------------------------------------------------------------------

Message: 1
Date: Mon, 27 Mar 2006 07:18:16 -0800
From: Steve Hannah <shannah at sfu.ca>
Subject: Re: [FX.php List] Subject:  Mass Mailing Techniques
To: "FX.php Discussion List" <fx.php_list at mail.iviking.org>
Message-ID: <E6720ED5-29EE-4096-94F6-4298239BC09A at sfu.ca>
Content-Type: text/plain; charset="windows-1252"

Hi Scott,

One solution for this is to increase the timeout in the php.ini  
file.  Personally I don't like this solution as it will only buy you  
a little bit of extra time.

A better solution is to create a script that only sends a single  
email and have this script continually called to send an email to  
each address.  A common method is to call the script by way of <img>  
tags (so you include the multiple copies of the script as images in a  
main web page.   Another way is to use Javascript and XMLHTTPRequest,  
to make the continuous calls.  If you do the <img> tags method, then  
the script should produce an image file that can be displayed (one  
for success and one for failure).

Let me know if this doesn't make sense, and I can produce an example  
for you.


Best regards

Steve Hannah
On 23-Mar-06, at 10:41 AM, Scott Baetz wrote:

> Hello All,
>
>
> Our organization would like to begin distributing emails to our  
> membership.  We are using a basic html page, and have no problems  
> pulling the data from FX.php and into an array for final mailing.   
> However, when we execute the mail (a simple for loop calling mail()  
> function) we receive a timeout - I suspect from the mailing  
> element.  I've spent COUTNLESSS hours searching the we for  
> something meaningful relating to a solution.  Can anyone here point  
> me in the right direction?  I'm gathering that many of you are in  
> the same place at one point or another.
>
>
> Best regards,
>
>
>
> Scott Baetz
>
> sbaetz at soscs.net
>
> (603) 490-9988
>
> http://www.soscs.net
>
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list



----------------------------------------
Steve Hannah
Web Services Developer

Faculty of Applied Sciences
Simon Fraser University
shannah at sfu.ca
604-268-7228
Homepage: http://www.sjhannah.com



-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://www.iviking.org/pipermail/fx.php_list/attachments/20060327/28644289/a
ttachment-0001.html

------------------------------

Message: 2
Date: Mon, 27 Mar 2006 10:55:16 -0500
From: DC <dan.cynosure at dbmscan.com>
Subject: Re: [FX.php List] Subject:  Mass Mailing Techniques
To: "FX.php Discussion List" <fx.php_list at mail.iviking.org>
Message-ID: <44280AE4.3070802 at dbmscan.com>
Content-Type: text/plain; charset=windows-1252; format=flowed

two things.
post some relevant code.
test mail() function in your setup with just one recipient instead of an 
array.

dan

Scott Baetz had written:
> Hello All,
> 
>  
> 
> Our organization would like to begin distributing emails to our 
> membership.  We are using a basic html page, and have no problems 
> pulling the data from FX.php and into an array for final mailing.  
> However, when we execute the mail (a simple for loop calling mail() 
> function) we receive a timeout - I suspect from the mailing element.  
> I've spent COUTNLESSS hours searching the we for something meaningful 
> relating to a solution.  Can anyone here point me in the right 
> direction?  I'm gathering that many of you are in the same place at one 
> point or another.
> 
>  
> 
> Best regards,
> 
>  
> 
>  
> 
> Scott Baetz
> 
> sbaetz at soscs.net <mailto:sbaetz at soscs.net>
> 
> (603) 490-9988
> 
> http://www.soscs.net
> 
>  
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list


------------------------------

Message: 3
Date: Mon, 27 Mar 2006 10:09:03 -0600
From: Dale Bengston <dbengston at preservationstudio.com>
Subject: Re: [FX.php List] Subject:  Mass Mailing Techniques
To: "FX.php Discussion List" <fx.php_list at mail.iviking.org>
Message-ID:
	<64B837B3-933B-4D81-9470-CB4B6B91CF62 at preservationstudio.com>
Content-Type: text/plain; charset="windows-1252"

Scott,

You can also temporarily boost the timeout on your page with  
set_time_limit().

http://us2.php.net/manual/en/function.set-time-limit.php

-Dale


On Mar 27, 2006, at 9:18 AM, Steve Hannah wrote:

> Hi Scott,
>
> One solution for this is to increase the timeout in the php.ini  
> file.  Personally I don't like this solution as it will only buy  
> you a little bit of extra time.
>
> A better solution is to create a script that only sends a single  
> email and have this script continually called to send an email to  
> each address.  A common method is to call the script by way of  
> <img> tags (so you include the multiple copies of the script as  
> images in a main web page.   Another way is to use Javascript and  
> XMLHTTPRequest, to make the continuous calls.  If you do the <img>  
> tags method, then the script should produce an image file that can  
> be displayed (one for success and one for failure).
>
> Let me know if this doesn't make sense, and I can produce an  
> example for you.
>
>
> Best regards
>
> Steve Hannah
> On 23-Mar-06, at 10:41 AM, Scott Baetz wrote:
>
>> Hello All,
>>
>>
>> Our organization would like to begin distributing emails to our  
>> membership.  We are using a basic html page, and have no problems  
>> pulling the data from FX.php and into an array for final mailing.   
>> However, when we execute the mail (a simple for loop calling mail 
>> () function) we receive a timeout - I suspect from the mailing  
>> element.  I've spent COUTNLESSS hours searching the we for  
>> something meaningful relating to a solution.  Can anyone here  
>> point me in the right direction?  I'm gathering that many of you  
>> are in the same place at one point or another.
>>
>>
>> Best regards,
>>
>>
>>
>> Scott Baetz
>>
>> sbaetz at soscs.net
>>
>> (603) 490-9988
>>
>> http://www.soscs.net
>>
>>
>> _______________________________________________
>> FX.php_List mailing list
>> FX.php_List at mail.iviking.org
>> http://www.iviking.org/mailman/listinfo/fx.php_list
>
>
>
> ----------------------------------------
> Steve Hannah
> Web Services Developer
>
> Faculty of Applied Sciences
> Simon Fraser University
> shannah at sfu.ca
> 604-268-7228
> Homepage: http://www.sjhannah.com
>
>
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list

-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://www.iviking.org/pipermail/fx.php_list/attachments/20060327/2927fcd5/a
ttachment-0001.html

------------------------------

Message: 4
Date: Mon, 27 Mar 2006 10:13:54 -0600
From: Dale Bengston <dbengston at preservationstudio.com>
Subject: Re: [FX.php List] FMSkipRecords
To: "FX.php Discussion List" <fx.php_list at mail.iviking.org>
Message-ID:
	<A486CFDA-7AB8-429F-B305-CD95BE7A2369 at preservationstudio.com>
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed

Hi Jonathan,

What error are you getting back from FX in $searchResult 
['errorCode']? If it's 401 (no records), I'd suggest wrapping each of  
your search parameters in an if statement to determine whether it's  
blank, and filter out the blank params before you do your FMFind.

Dale

On Mar 24, 2006, at 1:25 PM, Jonathan Foerster wrote:

> Hello!
>
> I am trying to get the FMSkipRecords function to work.  The code  
> below fails to return any records (when there should be several  
> pages worth).
>
> I have stolen much of this code, trying to get something to work  
> (thanks to you, if you unwittingly contributed).  Thanks!
>
> Jonathan Foerster
>
> <?php
> include_once('FX/FX.php');
> include_once('FX/server_data.php');
>
> $Title=$_POST['Title'];
> $Author=$_POST['Author'];
> $Year=$_POST['Year'];
> $Department=$_POST['Department'];
> $Keywords=$_POST['Keywords'];
> $Advisor=$_POST['Advisor'];
> $Records=$_POST['Records'];
> $Sort=$_POST['Sort'];
> $Classification=$_POST['Classification'];
>
> if(isset($_POST['skip'])){ $skipSize=$_POST['skip'];}else 
> {$skipSize='5';}
>
> $search=new FX($serverIP,$webCompanionPort);
> $search->SetDBData('FieldStudies.fp7','Entry', $Records);
> $search->SetDBPassword($webPW,$webUN);
> $search->AddDBParam('Title',$Title,$operator);
> $search->AddDBParam('Author',$Author,$operator2);
> $search->AddDBParam('Year',$Year,$operator3);
> $search->AddDBParam('Department',$Department);
> $search->AddDBParam('Description',$Keywords,$operator4);
> $search->AddDBParam('Advisor',$Advisor,$operator5);
> $search->AddDBParam('Type',$Classification);
> $search->AddSortParam($Sort,'ascend');
> $search->FMSkipRecords($skipSize);
> $searchResult=$search->FMFind();
> ?>
>
>
> <table>
> <tr>
> <td>
> <?php
> if (strlen($searchResult['linkPrevious']) < 1) {
> ?>
> &laquo;- Previous
> <?php
> } else {
> ?>
> <a href="?skip=<?php echo($skipSize) ?>"><strong>&laquo;- Previous</ 
> strong></a>
> <?php
> }
> ?>
> </td>
> <td>
> <?php
> if (strlen($searchResult['linkNext']) < 1) {
> ?>
> Next -&raquo;
> <?php
> } else {
> ?>
> <a href="?skip=<?php echo($skipSize) ?>"><strong>Next -&raquo;</ 
> strong></a>
> <?php
> }
> ?>
> </td>
> </tr>
> </table>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list



------------------------------

Message: 5
Date: Mon, 27 Mar 2006 09:51:01 -0700
From: Chris Hansen <chris at iViking.org>
Subject: Re: [FX.php List] FMSkipRecords
To: "FX.php Discussion List" <fx.php_list at mail.iviking.org>
Message-ID: <328BD77A-A15B-4261-8CE6-D0D1C7301471 at iViking.org>
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed

Jonathan,

At least part of your problem is that you're mixing the $_GET and  
$_POST arrays on a page, even though usually only one will contain  
data.  For example:

1) if someone clicks your skip links, the data will be sent via GET  
(so elements of the $_POST array will be empty)
2) you're pulling data from $_POST['skip'] which would never be  
populated per (1) above

I suspect that there's a dynamic search form and you then want to  
allow users to browse through paged records.  If that's the case,  
here are a couple of pointers:

1) Use sessions or hidden inputs to keep track of the current search  
parameters.  Basically, the solution will need some way to track what  
the current search is for each user between pages, since your search  
parameters will not automatically be resent.

2) You might consider changing your link so that it submits a form,  
rather than linking to another page.  That way could could keep track  
of the search parameters as hidden elements, always submit the page  
via POST (since the form method is specified in the form tag), but  
still retain the style of your interface.

HTH

--Chris Hansen
   FileMaker 7 Certified Developer
   Creator of FX.php
   "The best way from FileMaker to the Web."
   www.iViking.org


On Mar 24, 2006, at 12:25 PM, Jonathan Foerster wrote:

> Hello!
>
> I am trying to get the FMSkipRecords function to work.  The code  
> below fails to return any records (when there should be several  
> pages worth).
>
> I have stolen much of this code, trying to get something to work  
> (thanks to you, if you unwittingly contributed).  Thanks!
>
> Jonathan Foerster
>
> <?php
> include_once('FX/FX.php');
> include_once('FX/server_data.php');
>
> $Title=$_POST['Title'];
> $Author=$_POST['Author'];
> $Year=$_POST['Year'];
> $Department=$_POST['Department'];
> $Keywords=$_POST['Keywords'];
> $Advisor=$_POST['Advisor'];
> $Records=$_POST['Records'];
> $Sort=$_POST['Sort'];
> $Classification=$_POST['Classification'];
>
> if(isset($_POST['skip'])){ $skipSize=$_POST['skip'];}else 
> {$skipSize='5';}
>
> $search=new FX($serverIP,$webCompanionPort);
> $search->SetDBData('FieldStudies.fp7','Entry', $Records);
> $search->SetDBPassword($webPW,$webUN);
> $search->AddDBParam('Title',$Title,$operator);
> $search->AddDBParam('Author',$Author,$operator2);
> $search->AddDBParam('Year',$Year,$operator3);
> $search->AddDBParam('Department',$Department);
> $search->AddDBParam('Description',$Keywords,$operator4);
> $search->AddDBParam('Advisor',$Advisor,$operator5);
> $search->AddDBParam('Type',$Classification);
> $search->AddSortParam($Sort,'ascend');
> $search->FMSkipRecords($skipSize);
> $searchResult=$search->FMFind();
> ?>
>
>
> <table>
> <tr>
> <td>
> <?php
> if (strlen($searchResult['linkPrevious']) < 1) {
> ?>
> &laquo;- Previous
> <?php
> } else {
> ?>
> <a href="?skip=<?php echo($skipSize) ?>"><strong>&laquo;- Previous</ 
> strong></a>
> <?php
> }
> ?>
> </td>
> <td>
> <?php
> if (strlen($searchResult['linkNext']) < 1) {
> ?>
> Next -&raquo;
> <?php
> } else {
> ?>
> <a href="?skip=<?php echo($skipSize) ?>"><strong>Next -&raquo;</ 
> strong></a>
> <?php
> }
> ?>
> </td>
> </tr>
> </table>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>



------------------------------

_______________________________________________
FX.php_List
FX.php_List at mail.iviking.org
http://www.iviking.org/mailman/listinfo/fx.php_list

End of FX.php_List Digest, Vol 20, Issue 29
*******************************************



More information about the FX.php_List mailing list