PHP send email foreach - send to

前端 未结 2 1536
慢半拍i
慢半拍i 2021-01-29 09:52

I\'m using a script to send email to checked users (approval), but script is sending only to first checked user, here\'s the script:

if (isset($_POST[\'approve\'         


        
相关标签:
2条回答
  • 2021-01-29 10:10

    You are defining your sendEmail() function inside your loop. The function is defined in the first iteration of your loop, in the second iteration the error is thrown (because the function already exists) and your script stops. Move the function definition it out of the loop.

    You should move ALL your function definitions out of the loop, a function can only be defined once.

    0 讨论(0)
  • 2021-01-29 10:14

    Move the sendEmail() function outside the foreach loop. Since it is inside the loop so you got the error Cannot redeclare sendEmail()

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