Can I use Ubercart to send an e-mail to all persons who purchased a certain product?

Posts: 14
Joined: 01/21/2008

I want to sell a series of e-mails via a Drupal website. This is a one-time charge for a series of, say, 12 messages - one per week for three months. Each purchaser also would be granted access to a forum.

It looks like Ubercart can take payment via PayFlow Pro and assign a role to allow access to the forum.

But I am unclear about how I could handle the e-mails.

I haven't yet installed Ubercart, but from what I've read online, it offers a Notification feature. Would this allow me to create an HTML e-mail and mass send it to everyone who had bought this product? If so, I could use it to manually send the message each week to all "subscribers."

I've read elsewhere about autoresponders, which would send scheduled messages automatically, but I haven't been able to find such software that would take PayFlow Pro and offer forum role assignment. At the moment, Ubercart looks most promising, IF I can figure out a way to send the e-mails, even if each batch must be sent manually.

Alternatively, is there a way I could extract the e-mail list from Ubercart of all who bought that item so I could send the e-mails via a separate utility?

Thanks for any thoughts!

Posts: 332
Joined: 08/07/2007
Administrator

There's a number of solutions to this problem, most of them I think would require some custom code. If you just wanted a straight list of emails from people that purchased a particular product, you could just make the following SQL query to your database:

SELECT DISTINCT(u.mail) FROM `uc_order_products` as p LEFT JOIN uc_orders as o ON p.order_id = o.order_id LEFT JOIN users as u ON o.uid = u.uid WHERE nid = {Node ID of particular product}

--

-Shawn Conn: If the Name Don't Rhyme It Ain't Mine

Posts: 1293
Joined: 08/14/2007
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.

Yeah, sounds like you'd want to hook into hook_cron, write a custom module that (when Cron is run) executes the query in Shawn's post above. You might make an "intermediary" Database Table, to keep track of users that have been notified; just in case you run Cron a bunch of times, you don't want the same people to get duplicate emails.

With the help of a uc_roles product and feature combination, you could sell the role of "subscriber" and then your custom module could send out the emails when Cron is run, only to users belonging to the "Subscriber" role. (Cron will need to be setup on your server - it's easy if you have phpMyAdmin and a Linux / Plesk server).

For more info on Cron with Linux click here: http://www.google.com/url?sa=t&ct=res&cd=2&url=http%3A%2F%2Fwww.linuxhel...

On my Plesk box I have it setup like this:

/usr/bin/wget -O - -q http://www.example.com/cron.php 5 * * * *
(That runs it on the 5th minute of every hour).

Hope this helps.

--

"Pain don't hurt." - Dalton

Mike Nelson's RiffTrax! www.rifftrax.com