Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9243259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:46:16+00:00 2026-06-18T08:46:16+00:00

I am working on a script developed by other developer. There is an alert

  • 0

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 require_once PHPMailer

<?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'; // <- PHP Mailer is requir_once in this file
    //........... ajax and some response //
?>

As soon as I require_once it generates an email and dispatch that.

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.

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

<?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'; // <- PHP Mailer is requir_once in this file
    //........... ajax and some response //
    if($condition){
        include '2.php'; // <- this file again require_once 'module_alert.php'
        include '3.php'; // <- this file again require_once 'module_alert.php'
    }
?>

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.

What are my options to survive in this condition?

EDIT

In module_alerts.php 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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T08:46:17+00:00Added an answer on June 18, 2026 at 8:46 am

    The logic to dispatch an email should be wrapped in a function which you can then call, with the appropriate parameters, at any point in your program. For example:

    function sendMyEmail($recipient, $subject, $message)
    { ... }
    

    You could of course build a class, a series of functions, really any sort of legitimate reusable facility and this would alleviate the problem both now and in the future.

    HTH

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a working script from someone, there in is this line: this.event =
I have developed a perl script which provides a menu driven functionality to allow
I am working on maintaining some page developed by someone other. I have noticed,
I have a script working well for creating ad hoc iPhone builds. I can
i am working on script which creates events in Google Calendar from data in
I have working registration script the only problem is that i do not know
So I have my upload script working just fine, but now it's a matter
I've developed java script to draw graphical shapes using Raphael. Its perfectly works with
I have written my first script for Greasemonkey, it is working great, except that
I have been working on a project on a Windows 7 system, using StrawberryPerl

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.