Hello. I have a CF application that is used to track membership in our club. There is about 6000 members in our membership database. One of the useful features about the membership database is that it is easy to code a CF application to send e-mails to various people in the database based on various criteria (i.e. position, address, hobbies, etc.).
The application uses the standard cfmail function in a database loop. For the most part it works pretty well.
The problem occurs when someone wants to send an e-mail to "everyone". Sometimes the application on the users side appears to "hang" so the user sends the e-mail again (clicks back and send) which makes people get duplicates.
Also our website hosting company limits the number of e-mails we can send per hour so this gets them mad and they threaten to shut me down. So I am trying to think of ways to change the code.
If I changed the program so that instead of doing a separate cfmail to each address it only collected the e-mail addresses and at the end did on cfmail bcc'ing all the receipts in one e-mail work? So if I was sending to 100 people, instead of sending 100 cfmails, it would only send 1 mail with 100 addresses in it?
Another alternative I was thinking of was that instead of actually sending the email, the CF application would just collect all the e-mail addresses and at the end it would create a "mailto" hyperlink with all the addresses in a BCC that the user would click on that would startup their e-mail client and the addresses would be prefilled and then they could type the e-mail up in their email client and sending the e-mail would be from their computer and not the server.
Looking for any suggestions and/or comments.
The maximum number of addresses in the BCC field would be limited by your host. Using BCC would be a good option if you do not need to personalize each email.
An alternative would be to use a third party mail service for your mass emails. Something like Mailchimp would run about $10 per month and you could see all sorts of great stats. Many other services out there as well, each offering features that might make life easier from ColdFusion (like APIs, templates, etc).
In my professional opinion, there really isn't a "good" way to do mass email, yourself. As you've pointed out, your hosting provider gets a little hot under the collar when you send 6000+ emails, and I can't imagine them not getting hot under the collar if you send 600+ emails each addressed to 100 users. As far as the mailto link idea, that does sound better, but the downside to that being the user's ISP might get mad and blacklist the user for spamming. And it's not easy to get off that blacklist.
An idea might be a third party. There are businesses that do the mass email thing for you, which should keep your hosting provider from getting mad at you, shouldn't put the burden on any of your users, and it may cost a little to do, but might be the best option.
But this is just my opinion. I'm sure others might have better ideas.
^ _ ^
Thanks for the replies....it appears my frustration is justified. I was thinking of using a service like MailChimp, but I didn't think my type of e-mails would work. In particular:
1) any of my 6,000 users can signon to our CF application and send an email. I didn't want to have to instruct all my users how to create a MailChimp account and how to use it.
2) When a user composes an e-mail they have all sorts of choices on who would get the email (City, what kind of Officer they are, its their birthday month, they like to fish, etc.). I don't want to code all those hundreds of e-mail combinations in MailChimp.
I see that MailChimp has API services, probably to solve populating address lists, but I think I am still stuck with the #1 problem above.
I was also looking at subscribing to a SMTP relay service so that when I do execute the cfmail statements it would use the SMTP relay vendor to send the email, not my web provider.
Third party services usually allow you to create groups (solving problem #1) and create templates (solving problem #2). Templates are parameterized and you can simple drop in whatever bits you need to provide. You can also just use the service as a relay, although please be sure to read up on this first and make some careful decisions so your mail isn't marked as spam. Having a domain blacklisted is not fun.
Rereading, #1 above - you would use a single account to send mail via the API. You just change the from/to accordingly, just as you do now with CFMAIL.
Dennis, as has been discussed, you can consider using an alternative SMTP server, by way of 3rd party services. MailChimp was mentioned, but that’s really more of a category of email marketing services, whereas services that would just act as an alternative mail server for you (that you’d point to from your CF Admin or CFMAIL tag) would be more what I’d think you’d want.
I keep a list of both types, as categories of my CF411.com site, specifically:
Even so, I’d be worried that you may still suffer the problem that if the process sending the email takes long, users may get antsy and hit submit again. That’s its own problem, with any of many possible solutions depending on the actual cause of the slowness. For instance, It may be slow gathering data from the database, rather than actually “sending” the email.
As you may know, CF doesn’t “send each email for each CFMAIL execution”. Instead, it “spools” the email (writing it to folder, where then CF watches that folder and in a background process sends off each email, perhaps after a request sending email has finished, as there is a CF admin setting for the duration between checks of that spool).