just use the mod function:

(it would be much easier if you had mail0, mail1, and mail2 as servers)

<cfset maxServers = 3>

<cfloop query="foo"...>
        <cfset theMod = currentRow MOD maxServers>
        <cfmail server="mail#theMod#"...>
        </cfmail>
</cfloop>

in case you don't know, MOD will give you the remainder after dividing value
A by value B.  When MODing by 3 it will always be 0, 1, or 2.

+-----------------------------------------------+
Bryan Love
  Macromedia Certified Professional
  Internet Application Developer
  Database Analyst
Telecommunication Systems
[EMAIL PROTECTED]
+-----------------------------------------------+

"...'If there must be trouble, let it be in my day, that my child may have
peace'..."
        - Thomas Paine, The American Crisis



-----Original Message-----
From: Jon Hall [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 16, 2002 9:55 AM
To: CF-Talk
Subject: Re: rotating mail servers - cfmail...


Using a query column with the email addresses...
Divide the number of email by three, and use the udf
http://www.cflib.org/udf.cfm?ID=117 to spilt the query into 3 even parts.

Are these emails personalized, or are they all the same piece of
email? If they are all the same, then just use the query column as your
cfmail. Otherwise you will still need to loop.

<cfmail to="#mailserver1.emails#" ...>
<cfmail to="#mailserver2.emails#" ...>

-- 
jon
mailto:[EMAIL PROTECTED]

Friday, August 16, 2002, 12:32:36 PM, you wrote:

B> Hey everyone, I'm writing a mail app and looking for suggestions for a
cool
B> way to handle part of the app:

B> I am sending a bunch of emails out with CFMAIL. I am looping over a list
of
B> the addresses, it could be from a query or a struct or an array, doesn't
B> really matter to me or the app, anyway, as I loop over the emails I would
B> like to have the app evenly distribute the mails between any number of my
B> mail servers, to keep the load lighter on all of them. It could be any
B> number, but right now it is 3: mail, mail2, and mail3. Anyone have any
B> thoughts about a really cool or elegant way to do this? Thanks y'all.
B> Buddy


______________________________________________________________________
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to