PHP send mail to multiple email addresses

后端 未结 14 1370
盖世英雄少女心
盖世英雄少女心 2020-11-27 06:49

What code I should do change in this PHP script to send one email to more than 20 email addresses?



        
相关标签:
14条回答
  • 2020-11-27 07:07

    Your

    $email_to = "address@one.com, address@two.com, address@three.com"
    

    Needs to be a comma delimited list of email adrresses.

    mail($email_to, $email_subject, $thankyou);
    
    0 讨论(0)
  • 2020-11-27 07:08

    This worked for me,

    $recipient_email = 'sales@abc.com,support@xyz.com';
    
    $success = mail($recipient_email, $subject, $body, $headers);
    
    0 讨论(0)
  • 2020-11-27 07:09

    Something like this:

    mail("john@doe.com , marry@mail.com , frank@domain.com", "Test e-mail", "Hi, this is a test message!");
    

    http://myphpform.com/php-form-multiple-recipients.php

    0 讨论(0)
  • 2020-11-27 07:09

    Programmatically sending an submitted form to multiple email address is a possible thing, however the best practice for this is by creating a mailing list. On the code the list address will be place and any change or update on email addresses to the recipients list can be done without changing in the code.

    0 讨论(0)
  • 2020-11-27 07:11

    It is very bad practice to send all email addresses to all recipients; you should use Bcc (blind carbon copies).

        $from = "myname@mymail.com";
        $recipList = "mailaddress1,mailaddress2,etc";
        $headers = "MIME-Version: 1.0\nContent-type: text/html; charset=utf-8\nFrom: {$from}\nBcc: {$recipList}\nDate: ".date(DATE_RFC2822);
        mail(null,$subject,$message,$headers); //send the eail
    
    0 讨论(0)
  • 2020-11-27 07:12

    Just separate them by comma, like $email_to = "youremailaddress@yourdomain.com, emailtwo@yourdomain.com, John Doe <emailthree@example.com>".

    0 讨论(0)
提交回复
热议问题