Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2004
    county durham, UK

    mail for and php

    I'm trying to send more than one email per option choose. when software is chosen it will pass an array of different email addresses and send it to them.

    e.g. when software is selected, then the email will be send to a number of addresses associated with that option.

    Here's what i have so far, which just sends one email. can anyone please show me how to solve my problem. thanks!!

    <td><div align="left">
    <select name="typesupport" id="typesupport">
    <option selected>--select type--</option>
    <option value="hardware">hardware</option>
    <option value="software">software</option>



    PHP Code:
    /*Here we are going to declare the variables*/
    $name = $_POST['name'];
    $company = $_POST['company'];
    $email = $_POST['email'];
    $location = $_POST['location'];
    $contactnum = $_POST['contactnum'];
    $typesupport = $_POST['typesupport'];
    $ipaddress = $_POST['ipaddress'];
    $probdesc = $_POST['probdesc'];
    $hsolved = $_POST['hsolved'];

    //Save visitor name and entered message into one variable:

    $subject = "log problem with microcomputing";
    $formcontent="PROBLEM LOGGED BY ------- $name\n\nCLIENT NAME ------- $company\n\nLOCATION ------- $location\n\nCONTACT NUMBER ------- $contactnum\n\n
    TYPE OF SUPPORT ------- $typesupport\n\nIP ADDRESS ------- $ipaddress\n\nDESCRIPTION OF PROBLEM ------- $probdesc\n\nHAS THIS PROBLEM BEEN SOLVED BEFORE? ------- $hsolved";

    /*mail header*/
    $mailheader = "From: $email\r\n";
    $mailheader .= "MIME-Version: 1.0\r\n";

    $valid_emails = array("steve.gordon","ian.blevins");

    $recipient = $_POST['typesupport'] . "";

    mail($recipient, $subject, $formcontent, $mailheader);
    echo "mail has been sent";

    echo "problems sending the email. Have a word!";


  2. #2
    Join Date
    Mar 2004
    don't you need a loop?
    your if statement will be executed once, thus either 1 or zero email will be sent.

Posting Permissions

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