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

Posted on 2011-04-27
Last Modified: 2013-12-13
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 = "";
$adminaddress = "";

$siteaddress ="";

$sitename = "";


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 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";


Question by:julianne26
    LVL 4

    Accepted Solution

    The fault is in the first two lines:
    $adminaddress = "";
    $adminaddress = "";

    Open in new window

    By assigning "" to  $adminaddress in the second line the previous value "" assigned in the first line is overwritten.

    To send to multiple recipients you would have to use an RFC 2822 compliant string like,

    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 = "";
    $adminaddress2 = "";

    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

    Good luck!

    Author Comment

    YOUR AWESOME thanks!!!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Training Course: Java/J2EE and SOA

    This course will cover both core and advanced Java concepts like Database connectivity, Threads, Exception Handling, Collections, JSP, Servlets, XMLHandling, and more. You'll also learn various Java frameworks like Hibernate and Spring.

    Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit ( and similar technologies have enjoyed wide adoption, making it possib…
    I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
    The viewer will learn how to dynamically set the form action using jQuery.
    The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now