Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    mex
    mex is offline
    Regular Coder
    Join Date
    Jul 2003
    Location
    somewhere
    Posts
    134
    Thanks
    0
    Thanked 0 Times in 0 Posts

    PHP Mail not sending more than 1 email

    this is a php script. It works well but doesn't seem to send more than an email.... Can anyone help me out so that the script can be sent to more than one email using comma or whatever for seperation. thanx

    PHP Code:
    <?php
    if ($state == "")
    {
        
    }
    else
    {

        
    $announce="Your message has been sent successfully...";
        if (
    $ccText != ""$ccText="cc: $ccText <$ccText>\n";
        if (
    $bccText != ""$bccText="Bcc: $bccText <$bccText>\n";
        if (
    $mailformat == "Text"mail($toText$subjectText$msgText,     "To: $toText <$toText>\n" .     "From: $fromText <$fromText>\n" .$ccText.$bccText.   "X-Mailer: PHP 4.x");
        if (
    $mailformat == "Html"mail($toText$subjectText$msgText,     "To: $toText <$toText>\n" .     "From: $fromText <$fromText>\n" .$ccText.$bccText.     "MIME-Version: 1.0\n" .     "Content-type: text/html; charset=iso-8859-1");
    }

    ?>
    <?php 
    echo($announce)?>
    Wonder

  • #2
    Regular Coder
    Join Date
    Apr 2004
    Posts
    298
    Thanks
    0
    Thanked 23 Times in 23 Posts

    Smile

    If nothing else, this script may spark an idea for you.

    I didn't test it, as my inlaws might think I like them if I send them more than one email a week

    Code:
    <?PHP
    // this script presumes the following:
    // 1. the data is in a text file
    // 2. each record has the format of    first_name|last_name|email_address
    // NOTE: with a little work you can adapt this to use a mysql database table for your data source
    
    // put the entire csv file into an array
    
    $all_lines = file('people.txt'); 
    
    // count the number of lines in the file and store it in a variable
    
    $how_many_lines = count($all_lines);
    
    // take each line and 
    //	1. separate each line into its individual elements (aka fields aka pieces of information)
    //	    using the EXPLODE () function.
    //	2. grab the value(s) you are going to test and place them in a variable(s). Remember the
    //	    count for the elements starts at 0 (zero). Also be careful that your variables don't 
    //	    contain extraneous parts (like extra spaces, newlines and tabs). Use the TRIM() function to
    //	    clean up.
    //	3. do your evaluation. 
    
    for ($i = 0; $i < $how_many_lines; $i++) { 
      $all_fields[$i] = explode(',', $all_lines[$i]); 
      $first_name = trim($all_fields[$i] [0]);
      $last_name = trim($all_fields[$i] [1]);
      $email_address = trim($all_fields[$i] [2]);
       // send the email
    $subject = "Your Registration!"; 
    $message = "Dear $first_name $last_name, 
    
    Thank you for registering at our website, http://www.whatever..com! 
    
    Please print and save this information.
    (this is the information supplied on the Registration Page)
    ---------------------------------------------------------
    
    Just type your message here
    make it as long as you want
    
    -------------------------------------
    If you have any questions, or this registration is not
    correct, please contact us.
    
    Thanks! 
    
    The Joe Camel
    
    This is an automated response, please do not reply!"; 
    
    mail($email_address, $subject, $message, 
    
    "From: Webmaster<joecamel@whatever.com>\n 
    
    X-Mailer: PHP/" . phpversion()); 
    }
    ?>
    Lite...

  • #3
    mex
    mex is offline
    Regular Coder
    Join Date
    Jul 2003
    Location
    somewhere
    Posts
    134
    Thanks
    0
    Thanked 0 Times in 0 Posts
    hope the script can send more than to 1 email....thanx
    Wonder


  •  

    Posting Permissions

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