Sending multiple emails with PHPmailer

前端 未结 2 871
广开言路
广开言路 2021-01-14 14:26

Edit: I forgot I\'d created the SendMail(); function myself, which is why the explanation doesn\'t mention at first what it does.

I\'m having s

2条回答
  •  孤城傲影
    2021-01-14 15:19

    You haven't posted this code that lets me make this a complete conclusion, but from the Exception and the way you've defined an overriding class inside a function, you probably have class.phpmailer.php loading every time like this:

    require('class.phpmailer.php');
    

    or

    include('class.phpmailer.php');
    

    You should change that line to

    require_once('class.phpmailer.php');
    

    The reason you need to change it to require_once is so that PHP will not load the class file the second time when you try to create the new/second PHPMailer class. Otherwise, the line class PHPMailer throws the __clone() exception.

提交回复
热议问题