Jump to content

Recommended Posts

I have an email script in php that sents to two email addresses. I need to know how to expand this to send many more than two(Up to 10). Below is the script. This script is activated from another page with a form on it. iT IS ALOS BELOW I would aqppreciate your help.

***********************************************************************

<?php

$to = trim($_POST['to']);

$from = trim($_POST['from']);

$subject = trim($_POST['subject']);

$message = trim($_POST['message']);

$copy = 'any@business-net.com';

//$bcc = "rany@tampabay.rr.com";

$send = mail($to,$subject,$message,"FROM: ".$from."\n\rCC: ".$copy);

if ($send) {

echo "Sent";

} else {

echo "Error sending";

}

?>

*********************************************************************

<form action='sendmail.php' method='post'>

<p> </p>

<p><font color="#FF0000"><strong>EMAIL TO ATTORNEY GENERAL JOHN ASHCROFT</strong></font></p>

<p>TO:

  <input type='text' name='to'>

  <br>

  FROM:

  <input type='text' name'from'>

  <br>

  SUBJECT:

  <input type='text' name='subject'>

  <BR>

  Enter Message:<br>

  <textarea name='message'></textarea>

  <br>

  <br>

  <input type='Submit' value='Send Message'>

</p>

******************************************************

 

Link to comment
https://forums.phpfreaks.com/topic/50584-email-script/
Share on other sites

never used the ".$copy); but you could make several statments like

 

$send = mail($to_1,$subject,$message,"FROM: ".$from."\n\rCC: ".);

$send = mail($to_2,$subject,$message,"FROM: ".$from."\n\rCC: ".);

$send = mail($to_3,$subject,$message,"FROM: ".$from."\n\rCC: ".);

$send = mail($to_4,$subject,$message,"FROM: ".$from."\n\rCC: ".);

 

where $to_1 to _4 are individual email address.

 

rCC: ? never used that.

 

 

$success = mail($to,$sss, $mmm, $headers);

Link to comment
https://forums.phpfreaks.com/topic/50584-email-script/#findComment-248659
Share on other sites

otuatail, Is this what yopu mean?

 

<?php

$to = trim($_POST['to']);

$from = trim($_POST['from']);

$subject = trim($_POST['subject']);

$message = trim($_POST['message']);

$send = mail($to_1,$subject,$message,"FROM: ".$from."\n\rCC: ".);

$send = mail($to_2,$subject,$message,"FROM: ".$from."\n\rCC: ".);

$send = mail($to_3,$subject,$message,"FROM: ".$from."\n\rCC: ".);

$send = mail($to_4,$subject,$message,"FROM: ".$from."\n\rCC: ".);

if ($send) {

echo "Sent";

} else {

echo "Error sending";

}

?>

 

What do I do with this?

$success = mail($to,$sss, $mmm, $headers);

Link to comment
https://forums.phpfreaks.com/topic/50584-email-script/#findComment-249971
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.