Dynadot Aftermarket: discover domain gems worth investing in. Visit our aftermarket.

Grab column from table and Php Mail?

SpaceshipSpaceship
SpaceshipSpaceship
Spacemail by SpaceshipSpacemail by Spaceship
Watch

edgetube

Established Member
Impact
1
This should be simple but I'm overthinking this.

I want to grab a column called Email in my table which looks like this:

|-Name---------Email---------Group|
|[email protected]|
|[email protected]|

I simply need to grab the Email column and place it into an array which goes into a To: field of a simple php mail function like

Code:
<?php

$Name = "Da Duder"; //senders name
$email = "[email protected]"; //senders e-mail adress
$to = "[email protected]";
$to .= "[email protected]";
 $mail_body = "The text for the mail..."; //mail body
$subject = "Subject for reviever"; //subject
$header = "From: ". $Name . " <" . $email . ">\r\n"; //optional headerfields

mail($recipient, $subject, $mail_body, $header); //mail command :)
?>
So the script should constantly add a new To field for each column it goes through.

Ideas and code would be helpful.

Thanks :o
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Grr I typed a reply but something killed it.

Anyway, if you're trying to send a single email to multiple recipients at once, you need to separate them with commas:

$to .= ", $nextEmail";

will work, as long as $nextEmail is the variable that holds the current row's email address in it. You need to loop through the results of your mysql_query function and you might find it easiest to use mysql_fetch_array. Do you know how to do that?
 
0
Close
Thanks; I sort of know how to use mysql_fetch_array, although I don't know how to put it into a list separated by commas...
 
0
Close
I just showed you how.
 
0
Close
AIVikingsAIVikings

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

A browser tab with a favicon next to the page title
Search members
You can now search for members by name, company, location and more. Open the search at the top of any page and choose Members. You will...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back