soniccool
soniccool

Reputation: 6058

Send email using php emailing to multiple people

I have a php email script here but it will only take one email. How can i set this up to take multiple emails say upto 500? if i were to enter them as such.... [email protected], [email protected], [email protected] ect sperated by commas?

From Address: <input type="text" id="from" value="[email protected]" size="40"><br>
Recipient Address: <input type="text" id="to" size="40"><br>
Subject: <input type="text" id="subject" size="40"><br>
Message: <br><textarea id="message" cols="50" rows="10"></textarea><br>
<input type="submit" onclick="javascript:sendmail()" value="SEND">


$headers = $_POST['headers'];
$from = $_POST['from'];
$to = $_POST['to'];
$subject = $_POST['subject'];
$message = $_POST['message'];
$headers .="From: $from";

mail($to, $subject, $message, $headers) or die("EMAIL FAIL");
echo $to."<br-->";
echo $subject."<br>";
echo $message."<br>";
echo $headers."<br>";
echo 'EMAIL SENT';

Upvotes: 0

Views: 531

Answers (2)

Kumar Saurabh Sinha
Kumar Saurabh Sinha

Reputation: 870

try this

<input type="text" id="to" value="[email protected], email2, email3, email4" name="to">

Upvotes: 1

Derrick Tucker
Derrick Tucker

Reputation: 792

Exactly as you put it in your question. Commas separate multiple recipients.

Mail() in the PHP manual is a good place to start.

Upvotes: 1

Related Questions