Results 1 to 8 of 8

Thread: mail functional

  1. #1
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default mail functional

    Would the mail() work with multiple contacts, separated by a comma and a space, inside a variable, that's in the string to part?

    ie...
    $names = john@yahoo.com, john@gmail.com, john@whatever.com;
    mail($names,something,something);
    Last edited by bluewalrus; 01-02-2009 at 10:23 PM.

  2. #2
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Only if you put it in the headers:
    Code:
    $headers .= 'To: john@yahoo.com, john@gmail.com, john@whatever.com' . "\r\n";
    Here: http://us3.php.net/manual/en/function.mail.php Scroll down to example #4.
    Jeremy | jfein.net

  3. The Following User Says Thank You to Nile For This Useful Post:

    bluewalrus (12-30-2008)

  4. #3
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    okay this gonna be a jump ahead from my last post. I think this will all work though. I'm going to have a form that takes an entered user address and submits it to a text file with a comma and a space (after entering this description will the space stay or should i put in an  ?) then adds a new line so the text file will be not be chaotic to look at regular ( it may need to be chaotic not sure yet this is all a big test kinda). Another page where a newsletter or something could be sent out to all the addresses would then open the text file and add all the contents with the , and space to the, 'to' line and then add the message and subject to the email. I think it makes about 75% sense at least...

    Form for submit email address
    PHP Code:
    <?php
    $name 
    $_POST['email'];
    $file "addresses.txt";
    $handle fopen($file"r+");
    $data $name ', ' "\n";
    fwrite($handle$data);
    fclose($handle);
    ?>
    submit message to emails
    PHP Code:
    <?php
    $message 
    $_POST['message'];
    $myfile "addresses.txt";
    $fh fopen($myfile'r');
    $thedata fread($fh20000000);
    fclose($fh);
    $to $thedata;
    $subject 'Subject test';
    mail($to$subject$message);
    echo 
    'Mail Sent';
    ?>

  5. #4
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Give it a try. Make sure to put it in the HEADERS though. And not the $to variable.
    Jeremy | jfein.net

  6. #5
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    The headers weren't to make it an html email? It looked liked they used the to function and the headers there but I didn't want to use the headers because I wasn't going to send HTML emails. I don't actually have anything to test this with yet its just an idea.

  7. #6
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    The header "To" is to send the email to multiple emails from what I know. Try both - I guess you should try your idea first, then if it doesn't work try mine. xD
    Jeremy | jfein.net

  8. The Following User Says Thank You to Nile For This Useful Post:

    bluewalrus (12-30-2008)

  9. #7
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    Okay I'll give them both a try in a bit. Have you had a chance to look at the adding permission thread since I updated it last? That ones really annoying me now because it's on a live page and I have to keep logging into the ftp to change it to 777. Well anyways thanks for your replies to both of these.

  10. #8
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    I got it all working now.
    Last edited by bluewalrus; 12-30-2008 at 10:19 PM.

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
  •