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
    New to the CF scene
    Join Date
    Jan 2010
    Posts
    7
    Thanks
    2
    Thanked 0 Times in 0 Posts

    php mail() multiple recipients

    Ok i got a problem, i need to select a name to include in the message
    the code looks like this:


    $data =date("m", time());
    $data1=date("d",time());

    mysql_select_db( $db, $link ) or die ( "Couldn't open $db: ".mysql_error() );
    $result = mysql_query( "SELECT Nome, Email FROM funcionarios where extract(day from Data_de_Nascimento)='$data1' and extract(month from Data_de_Nascimento)='$data' order by Data_de_Nascimento" );
    $num_rows = mysql_num_rows( $result );

    while ( $row = mysql_fetch_array( $result ) )
    {

    $to .= $row[Email] . ',';
    rtrim($to, ',');
    $na .= $row[Nome] . ','; //Name
    rtrim($na, ',');


    }

    $sub="Feliz aniversario";
    ini_set('SMTP', 'mail.clix.pt');
    $subject = "$sub";
    $message = "Sr. $na a fastforward ................................ Feliz aniversario";
    $headers = 'From: bitlo@clix.pt' . "\r\n" .
    'Reply-To: bitlo@clix.pt' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

    mail($to, $subject, $message, $headers);


    But in the message it apears all the names, and i need to associte a name to a email.....
    Can please some one HELP ME!!!!!

  • #2
    Regular Coder
    Join Date
    Dec 2009
    Location
    UK
    Posts
    495
    Thanks
    0
    Thanked 58 Times in 58 Posts
    If you want to assign names to email addresses you need to do it in the format
    Joe Bloggs <joe@bloggs.com>
    My site: JayGilford.com
    Resources:
    PHP Pagination Class | Getting all page links | Handling PHP Errors properly
    If you like a users help, show your appreciation with the rep and thanks buttons :)

  • Users who have thanked JAY6390 for this post:

    Tulungo (01-20-2010)

  • #3
    New to the CF scene
    Join Date
    Jan 2010
    Posts
    7
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by JAY6390 View Post
    If you want to assign names to email addresses you need to do it in the format
    Joe Bloggs <joe@bloggs.com>
    i need to get the names at Mysql:

    "SELECT Nome, Email FROM funcionarios where extract(day from Data_de_Nascimento)='$data1' and extract(month from Data_de_Nascimento)='$data' order by Data_de_Nascimento" );


    And i need to associte a name to a email:

    while ( $row = mysql_fetch_array( $result ) )
    {

    $to .= $row[Email] . ',';
    rtrim($to, ',');
    $na .= $row[Nome] . ','; //Name
    rtrim($na, ',');


    }

    Because in the message i got to put a text with is name on it:

    $message = "Sr. $na a fastforward ................................ Feliz aniversario";



    And they are a lot of Names....

    So in one mail the message got all the names and i need to put the name in the right message.


    Can please some one help me..
    Last edited by Tulungo; 01-20-2010 at 12:24 PM.


  •  

    Posting Permissions

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