Sending emails based on mysql data

Swift Mailer is a fantastic library for sending email with php. Discuss this library or ask any questions about it here.

Moderators: Chris Corbyn, General Moderators

Post Reply
User avatar
vinodc
Forum Newbie
Posts: 1
Joined: Mon Mar 16, 2009 7:59 am

Sending emails based on mysql data

Post by vinodc »

Hi

Im new to this forum. Also im not a php programmer actually.

I have my CentOS Linux based VoIP server running with PHP 5.1.6, mysql 5.0.45, Apache 2.2.3.

My mysql database table contains data like Username, Password, Balance, Address, Email addess, Phone, etc. The requirement is, i need to send email to the users whose "Balance" is <= somecredit.

Whether this logic is possible using a single php script, and if yes, can this script check the data for all the users and process sequentially?

Please advice me some help with the script...... :banghead:

Thanks in advance
Vino
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: Sending emails based on mysql data

Post by Chris Corbyn »

So you just need to write a SQL query basically that selects all users whose credit <= some amount.

Then using Swift Mailer is no different to any other program... you just use the email addresses returned from the database instead of hard-coding them in the script.

It's certainly possible :)
Post Reply