Dynadot .com transfer sale, only $10.12 with coupon code DYNA12, available while supplies last, ends October 31, 2026.

Grab column from table and Php Mail?

Namecheap AuctionsNamecheap Auctions
Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
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
•••
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
•••
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
•••
I just showed you how.
 
0
•••
DomainEasy: white label portfolios are live. Enable yours.

We're social

Escrow.com
Spaceship
Escrowly
CryptoExchange.com
Domain Recover
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back