PHP file containing email notice to staff

Helpdesk for my helpdesk software

Moderator: mkoch227

Post Reply
ArcherData
Posts: 10
Joined: Wed Aug 18, 2021 1:22 am

PHP file containing email notice to staff

Post by ArcherData »

Script URL: https://archerdata.com/helpdesk
Version of script: 3.2.3
Hosting company: Archer Data Hosting
URL of phpinfo.php: https://archerdata.com/serverprofile.php
URL of session_test.php:
What terms did you try when SEARCHING for a solution: email staff notice

Write your message below:

I am having difficulty locating the code file and block where emails are sent to staff when a new ticket is created.

Don
Don
Archer Data Hosting
Klemen
Site Admin
Posts: 10142
Joined: Fri Feb 11, 2005 4:04 pm

Re: PHP file containing email notice to staff

Post by Klemen »

Would help to know what you are trying to achieve.

If you only want to edit the messages, go to Admin > Tools > Email templates

If you want to change the email logic, it's mostly in inc/email_functions.inc.php

If a ticket is submitted using the web form, the mailing functions (hesk_notifyAssignedStaff, hesk_notifyStaff) are called from submit_ticket.php
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
ArcherData
Posts: 10
Joined: Wed Aug 18, 2021 1:22 am

Re: PHP file containing email notice to staff

Post by ArcherData »

I apologize for being a bit vague.

The support staff work remotely, so they don't always have HESK open.

What I want to have happen:
• When a new ticket is created, let HESK send emails to the submitter and to the staff as normal.
• I want to inject the PHP code to send a one-way SMS text message to the support staff to alert them there's a new ticket.
• This message is a canned and contains no details — just a "heads up" that a ticket came in.
• In my case, I don't even need a response via text message.

So, I need to know where to insert the block of PHP code that sends the SMS via the TextMagic service.

It would be great if there was a place that works like header.txt/footer.txt does to cleanly insert additional code at the appropriate spot.

I hope this helps.

Don
Don
Archer Data Hosting
ArcherData
Posts: 10
Joined: Wed Aug 18, 2021 1:22 am

Re: PHP file containing email notice to staff

Post by ArcherData »

On inspection of submit_ticket.php at the break at line 525 — this would (on the surface) seem like a place where the SMS text message code that connects to TextMagic and sends the alert might possibly go. Here's the PHP block:

Code: Select all

$client = new TextmagicRestClient('USERNAME', 'KEY');
$result = ' ';
try {
    $result = $client->messages->create(
        array(
            'text' => 'CANNED ALERT MESSAGE',
            'phones' => implode(', ', array('+12345678901'))
        )
    );
}
catch (\Exception $e) {
    if ($e instanceof RestException) {
        print '[ERROR] ' . $e->getMessage() . "\n";
        foreach ($e->getErrors() as $key => $value) {
            print '[' . $key . '] ' . implode(',', $value) . "\n";
        }
    } else {
        print '[ERROR] ' . $e->getMessage() . "\n";
    }
    return;
}
echo $result['id'];
My only concern is that something may interfere with HESK's logic and functions.

Don
Don
Archer Data Hosting
Klemen
Site Admin
Posts: 10142
Joined: Fri Feb 11, 2005 4:04 pm

Re: PHP file containing email notice to staff

Post by Klemen »

It will most likely go to the submit_ticket.php file.

To not interfere with Hesk, you will most likely need to get rid of the print and echo statements. Might be a good idea to ask a PHP developer for help to get you integrated properly.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
ArcherData
Posts: 10
Joined: Wed Aug 18, 2021 1:22 am

Re: PHP file containing email notice to staff

Post by ArcherData »

Thank you very much for your guidance.

Don
Don
Archer Data Hosting
Post Reply