#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    9
    Rep Power
    0
    Dear all,
    I have wrote a program to load a number of email address from the MYSQL database. And I have use
    "$mail = mysql_query("select email from user;",$link_ID);

    Now, I want to use mail() to send email to those e-mail account I got. What should I do for this?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Location
    Melbourne, Victoria, Australia
    Posts
    104
    Rep Power
    14
    First read the manual - http://www.php.net/mail and then if you still can't do it post back.

    As for the mysql side of things i have no idea no ever having used mysql in php before.

    Josh
  4. #3
  5. Banned (not really)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 1999
    Location
    Brussels, Belgium
    Posts
    14,642
    Rep Power
    4492
    Yes, please read the manual so that you know how to connect to MySQL and issue it queries.

    You can do this very easily by looping through the results and sending an email for each one, or creating a Cc: or Bcc: list...

    ---John Holmes...

    Here's a hint, I'm not going to explain it.

    $link_id = mysql_connect("host","user","pass");
    $db = mysql_select_db("database");

    $result = mysql_query("select email from table");
    while (list($email) = mysql_fetch_row($result))
    {
    mail($email,"Subject","Message",$headers);
    }


    There are other ways, too....

    ------------------
    *************************************************************
    * The manual can probably answer 90% of your questions...
    *
    * PHP Manual. www.php.net/manual
    * MySQL Manual: www.mysql.com/documentation/mysql/bychapter
    *************************************************************
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    9
    Rep Power
    0
    I am now studying the manual and
    trying. Thank you all!
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2000
    Posts
    2
    Rep Power
    0
    I understand the need to read the manual, but it is a little difficult to find the correct piece of code for a pariclular function - Is there a 'reverse engineered' manual available to say "It can do this, and this is the code to use", rather than "This code is very boring and here are the variables but we won't make it clear what it #really# does"?
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Location
    Melbourne, Victoria, Australia
    Posts
    104
    Rep Power
    14
    *harsh*

    If you understand the basic principles of PHP, and you understand SQL (learn how to if you don't) then the MYSQL and PHP manuals are really good - I've never had a problem with them before. You can't expect a manual to cover nearly enough situations/scenarios to answer anywhere near all of your questions.

    That's why we have mailing lists and DevShed forums etc

    Josh

Similar Threads

  1. Highlight search result from mysql database search
    By Gurt in forum PHP Development
    Replies: 3
    Last Post: February 17th, 2004, 03:39 AM
  2. send & receive mail to hotmail
    By kafsar in forum Mail Server Help
    Replies: 1
    Last Post: February 13th, 2004, 02:11 PM
  3. Help with script
    By akastarlight in forum Perl Programming
    Replies: 1
    Last Post: February 6th, 2004, 06:55 AM
  4. mysql -> mail (forgotten password)
    By Fraudo in forum PHP Development
    Replies: 2
    Last Post: January 13th, 2004, 07:06 PM
  5. how cana i send a html mail
    By darthnacho in forum HTML Programming
    Replies: 2
    Last Post: January 10th, 2004, 04:53 PM

IMN logo majestic logo threadwatch logo seochat tools logo