SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict trigger's Avatar
    Join Date
    Jun 2003
    Location
    Eagan
    Posts
    342
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Emailing to multiple addresses in a listbox

    I'm trying to email the results of a form to a number of email addresses. The form has a listbox that displays names, with the email addresses as values. You can select multiple entries in the listbox. I want the results of the form to be emailed to whichever names are picked when it is submitted.
    <?php
    foreach ($emailTo as $value){
    echo("$value");
    if ($contactName == 'None'){
    $message =. "Contact: $contactOther \n";
    }
    else if ($contactName != 'None'){
    $message =. "Contact: $contactName \n";
    }
    $message =. "Company Name: $companyName \n";
    $message =. "Site Name: $siteName \n";
    $message =. "Contact Person's Phone Number: $PhoneNumber \n";
    $message =. "Support Level: $supportType \n";
    $message =. "Expiration Date of Support: $supportExpires \n";
    $message =. "Sales Representative: $salesRep \n";
    $message =. "Problem With: $problem \n";
    $message =. "Description of Problem: $issue \n";
    if (@mail($value , 'Support Ticket Opened' , $message)) {
    echo('<p>Mail sent successfully.</p>');
    }
    else {
    echo('<p>Mail could not be sent.</p>');
    }
    }
    include 'resultspage.php';
    ?>

    I'm having problems finding out what the issue is, and I can't pinpoint it because my testing server is foo-bar'd. Any ideas?

  2. #2
    SitePoint Wizard bronze trophy
    Join Date
    Apr 2003
    Posts
    4,095
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dear everyone,

    Just a thought: since the <select> tag will produce an array, is the name of the <select> tag followed by "[]". (Example: <select multiple name="to_addresses[]">)

    Compuwhiz7

  3. #3
    SitePoint Addict trigger's Avatar
    Join Date
    Jun 2003
    Location
    Eagan
    Posts
    342
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    huh? I don't quite understand what would be the advantage to switching the values of my multiple select listbox into an array. I would still have to foreach through the array anyways, right? Or is my foreach loop done in the wrong way. I've done stuff similar to this before so it says <select name="emailTo[]" size="3" multiple="multiple" id="emailTo"> in the form field. Any other ideas?

  4. #4
    SitePoint Wizard bronze trophy
    Join Date
    Apr 2003
    Posts
    4,095
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dear everyone,

    I'm rather stumped... sorry!

    Compuwhiz7


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •