Multiple require_once of a file
<p>I am working on a script developed by other developer. There is an alert system which sends email and each module have its own alert file and that alert file <code>require_once</code> PHPMailer</p>

<pre><code>&lt;?php
    // assume this is 1.php
    //.......... some code above //
    $mail_title = 'Message Title';
    $mail_body = 'Message body with complete details what has been done here';    
    require_once 'module_alert.php'; // &lt;- PHP Mailer is requir_once in this file
    //........... ajax and some response //
?&gt;
</code></pre>

<p>As soon as I require_once it generates an email and dispatch that.</p>

<p>Now I have to update a PHP page in a module. That page have to post data to 3 different php pages of module. Before that page was sending data to only one php page VIA ajax, and other two pages use First one's auto incremented ID.</p>

<p>Due to complexity I am thinking to include the other two files as well in file 1</p>

<pre><code>&lt;?php
    // assume this is 1.php
    //.......... some code above //
    $mail_title = 'Message Title';
    $mail_body = 'Message body with complete details what has been done here';    
    require_once 'module_alert.php'; // &lt;- PHP Mailer is requir_once in this file
    //........... ajax and some response //
    if($condition){
        include '2.php'; // &lt;- this file again require_once 'module_alert.php'
        include '3.php'; // &lt;- this file again require_once 'module_alert.php'
    }
?&gt;
</code></pre>

<p>The problem is that I want to send alert for all 3 steps, and also I dont want to change a whole lot of code in other files as I might break the script. </p>

<p>What are my options to survive in this condition? </p>

<p><em>EDIT</em></p>

<p>In <code>module_alerts.php</code> there are number of things. Mail layout, tables images, conditional recipient, who should get alert for this module etc. $mail->send() function so to send email to particular receiver.</p>
