[Last Call] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 321
  • Last Modified:

I have a flash website and I need to be able to send PHP form results to multiple recipients

Hello, I have a flash website and I need to be able to send PHP form results to multiple recipients, however when I attempted to do so, the code didn't work.

Here is my code :


$adminaddress = "tschaudel@aol.com";
$adminaddress = "julie@targetgroupmedia.com";

$siteaddress ="http://www.tomschaudel.com";

$sitename = "www.tomschaudel.com";


No need to change anything below unless you want to add or subtract functions or change the wording of things sent back to the flash file ...


$date = date("m/d/Y H:i:s");

if ($REMOTE_ADDR == "") $ip = "no ip";
else $ip = getHostByAddr($REMOTE_ADDR);

if ($action != ""):
mail("$adminaddress","New Subscription",
"A visitor at $sitename subscribed to your mailing list.\n
Name: $name
email: $email

Logged Info :
Hostname: $ip
IP address: $REMOTE_ADDR
Date/Time:  $date","FROM:$adminaddress");

mail("$email","Thank You for visiting $sitename",
"Hi $name,\n
Thanks for subscribing to www.tomschaudel.com. We will be sure to keep you informed in all our upcoming VIP guestlists and receive updates about our parties, promotions and special events.
Thank you for your interest in $sitename!\n

$sendresult = "Thank you for applying. You will receive a confirmation email shortly.";
$send_answer = "answer=";
$send_answer .= rawurlencode($sendresult);
echo "$send_answer";


1 Solution
The fault is in the first two lines:
$adminaddress = "tschaudel@aol.com";
$adminaddress = "julie@targetgroupmedia.com";

Open in new window

By assigning "julie@targetgroupmedia.com" to  $adminaddress in the second line the previous value "tschaudel@aol.com" assigned in the first line is overwritten.

To send to multiple recipients you would have to use an RFC 2822 compliant string like
tschaudel@aol.com, julie@targetgroupmedia.com

Open in new window

for the receivers parameter in the PHP mail() function.

But as $adminaddress is used as sender address in the mail to the subscriber you cannot just assign two email addresses to $adminaddress (only one email address is allowed for the sender).

So I suggest you do something like that:
$adminaddress = "tschaudel@aol.com";
$adminaddress2 = "julie@targetgroupmedia.com";

Open in new window

And then change the first parameter in the mail function where you want to notify the two receivers to
if ($action != ""):
mail("$adminaddress,$adminaddress2","New Subscription",

Open in new window

Then the mail is sent to the two recipients. And the subscriber receives a mail sent by tschaudel@aol.com.

Good luck!
julianne26Author Commented:
YOUR AWESOME thanks!!!

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now