1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

send to multiple email addresses in php

Discussion in 'PHP' started by tonyrocks, Jun 24, 2009.

  1. #1
    I've got a php file that works fine when sending to one email address (from a flash form) but it won't work when I put two in? I need it to send the emails to me and someone else, whether it cc's them or just straight sends doesn't matter, its fine either way. I've tried this way-

    $to = "me@mysite.com,tom@mysite.com";
    PHP:
    and this way-
    SEMrush

    $to = "me@mysite.com";
    $to .= "tom@mysite.com";
    PHP:

    But neither seem to work, is there a different way to do it, those seemed the most obvious to me?

    Thanks in advance for any help with this, its really stumped me...
     
    tonyrocks, Jun 24, 2009 IP
    SEMrush
  2. risoknop

    risoknop Peon

    Messages:
    915
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Email addresses must be separated with comma:

    
    $to = 'me@mysite.com, tom@mysite.com';
    
    PHP:
    If that doesn't work, what kind of error are you getting?
     
    risoknop, Jun 24, 2009 IP
  3. TecBrat

    TecBrat Member

    Messages:
    31
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    48
    #3
    I regularly use
    $to='name@domain.com,name2@domain.com';
    PHP:
    The only difference I see is single quotes vs. double quotes. Like RK said, what error are you getting? I don't know if I've tried comma-space instead of just a comma as a separator.
     
    TecBrat, Jun 24, 2009 IP
  4. tonyrocks

    tonyrocks Active Member

    Messages:
    1,574
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    88
    #4
    no error that I can find, just doesn't seem to go anywhere. I'll try comma-space too.
     
    tonyrocks, Jun 24, 2009 IP
  5. www.amagit.com

    www.amagit.com Peon

    Messages:
    87
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    The external SMTP server may not be set up right. You'll have to make sure your php.ini settings are correct and check that the server is running.
     
    www.amagit.com, Jun 24, 2009 IP
  6. daljit

    daljit Active Member

    Messages:
    312
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #6
    we can send same message to multiple user by simply using php code like this
    $to='name1@domain1.com,name2@domain2.com'; in this code you can give multiple address by just seprating each address by (,)
     
    daljit, Jun 24, 2009 IP