Visit Jeremy's Blog.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 01-07-2004, 08:46 AM   #1
LQ Newbie
Registered: Jan 2004
Location: Germany
Distribution: SuSE 9.0
Posts: 10

Rep: Reputation: 0
Lightbulb Sending mass emails to a list of users - how?

Well, I am working on a web-page I did using the language php.Well, because the server is already up, but theirs no pages to view, I simply created a site where visitors can submit their e-mail addresses to be informed about the launch of the page.Now, I am sorta getting close to completion of the site, but now there is the question:
How do I send a mass-email to all the users stored in my MySQL db?Simply copy and paste all the addresses (which might take forever) or is there any better way?
Also, I had the idea to include a "Hello, <usernamewhichwassubmittedonthepagetogetherwiththeaddres>..." at the beginning of the email.How would I do this?
In advance, Thank you for your help!
Old 01-07-2004, 08:56 AM   #2
Senior Member
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Blog Entries: 1

Rep: Reputation: 67
If you plan on sending e-mails to these people on a regular basis I suggest getting mailman up and running on your machine. It'll read a mysql db for a subscriber list. Otherwise I would just right a small shell script to pull all the address out, throw them in the to: part of an email, and envoke sendmail or a sendmail wrapper on the whole thing, cause nobody wants to do that manually.
Old 01-07-2004, 08:59 AM   #3
LQ Newbie
Registered: Jan 2004
Location: Germany
Distribution: SuSE 9.0
Posts: 10

Original Poster
Rep: Reputation: 0
I guess Ill try that!
Old 01-07-2004, 04:41 PM   #4
Registered: Aug 2003
Distribution: RedHat
Posts: 35

Rep: Reputation: 15
This can be done with a php script that yanks the addresses out of a db. If you are new to php and mysql it can be a little daunting at first, but very worthwhile to learn.

(warning: very basic overview)

1) connect to your database
2) yank the variables out of the db and stick them into an array
3) loop through the array and build the email (of which the body could be called from an include) During the loop you will insert the variable in the array into the to: section of your mailheader. Then loop again selecting the next value in the array. Loop until array is finished.

Without going into extreme depth, I'll say this is not an extremely easy process, but the code you write will be re-usable and the experience invaluable for your future custom apps.

If you can do this, you can figure out how to do anything with php + mysql.
Old 01-08-2004, 11:22 AM   #5
LQ Newbie
Registered: Jan 2004
Location: Germany
Distribution: SuSE 9.0
Posts: 10

Original Poster
Rep: Reputation: 0
Thanks for the help!
Me luvs this forum, no "Newbie-haters" here!


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sending Emails Dragons_Way Linux - Software 2 03-09-2005 02:53 AM
qmail not sending emails lsimon4180 Linux - Software 1 10-18-2004 11:35 PM
Planned sending of emails Denisvt Programming 1 05-08-2004 08:34 AM
Maling List stops sending emails because my server is not configured efficiently pabloho7 Linux - Software 0 11-09-2003 12:32 PM
help with sending html emails pdelucia Linux - General 1 09-13-2003 11:06 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:30 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration