send feedback to multiple emails

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • maheshwarbirru
    New Member
    • Aug 2007
    • 1

    send feedback to multiple emails

    <?php


    // get posted data into local variables

    $EmailFrom = Trim(stripslash es($_POST[email]));

    $EmailTo = "abc@abclcom.co m";

    $Subject = "Website Feedback";

    $Name = Trim(stripslash es($_POST[name]));

    $Telephone = Trim(stripslash es($_POST[phone]));

    $Country = Trim(stripslash es($_POST[country]));

    $Comment = Trim(stripslash es($_POST[comm]));

    // prepare email body text

    $Body = "";

    $Body .= "Name: ";

    $Body .= $Name;

    $Body .= "\n";

    $Body .= "Telephone: ";

    $Body .= $Telephone;

    $Body .= "\n";

    $Body .= "Country: ";

    $Body .= $Country;

    $Body .= "\n";

    $Body .= "Email ID: ";

    $Body .= $EmailFrom;

    $Body .= "\n";

    $Body .= "Comments: ";

    $Body .= "\n";

    $Body .= $Comment;

    $Body .= "\n";

    $Body .= "\n";

    // send email
    $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>" );

    // redirect to success page
    if ($success){
    echo<<<End
  • assimlation
    New Member
    • Nov 2007
    • 9

    #2
    is this a question?

    if you're trying to send to mutiple addresses you'll need to accept an array as your TO data unless you have hard coded values or you're reading from a database, then you could run a for each loop running mail() function on each value..

    Comment

    Working...