Paypal email notifications

Helpdesk for my helpdesk software

Moderator: mkoch227

Post Reply
J_E_F_F
Posts: 30
Joined: Sun Sep 28, 2014 2:55 pm

Paypal email notifications

Post by J_E_F_F »

Version of script: 2.5.5
What terms did you try when SEARCHING for a solution: Paypal

I recently moved from Kayako eSupport to Hesk, the transition was really easy, thank you.

The one problem I have is when I receive an email notification of payment from paypal into Hesk.

The email username and email address are incorrect. I am not sure how eSupport handled it, but it worked flawlessly.

In Hesk, the following happens:

Name: J_E_F_F via PayPal
Email: member@paypal.com
Message:
Hello xxxxx,
This email confirms that you have received a donation of from (J_E_F_F@domain.net). You can view the transaction details online.

Before I can reply to the ticket, I have to go in and manually edit the ticket and copy/paste the correct email address from the message body into the email field on the ticket and remove the ...via PayPal from the Name field.

Is there a way to correct this within the Heck code?

Ideally, it should be entered and read as:

Name: J_E_F_F
Email: J_E_F_F@domain.net
Klemen
Site Admin
Posts: 10145
Joined: Fri Feb 11, 2005 4:04 pm

Re: Paypal email notifications

Post by Klemen »

The correct address is probably in the "Reply-To" email header.

I have this modification ready for next HESK version, so you can try uploading this file to your HESK "inc" folder and see if it helps (on new tickets, not existing ones):
http://www.hesk.com/extras/pipe_functions_reply_to.zip
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
J_E_F_F
Posts: 30
Joined: Sun Sep 28, 2014 2:55 pm

Re: Paypal email notifications

Post by J_E_F_F »

Worked perfectly, thank you.
J_E_F_F
Posts: 30
Joined: Sun Sep 28, 2014 2:55 pm

Re: Paypal email notifications

Post by J_E_F_F »

the 2.6.1 upgrade reverted the code so it now displays "...via PayPal" again.
What do I need to change to correct that?
Klemen
Site Admin
Posts: 10145
Joined: Fri Feb 11, 2005 4:04 pm

Re: Paypal email notifications

Post by Klemen »

These changes are INCLUDED in 2.6.x, are you sure this is happening on new emails and that you have the correct 2.6.1 files?
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
J_E_F_F
Posts: 30
Joined: Sun Sep 28, 2014 2:55 pm

Re: Paypal email notifications

Post by J_E_F_F »

Yes, positive. happening on 2.6.1 on an email I received this morning.
I updated to 2.6.1 yesterday, and previously had your modified file in place for 5 months without issue.
Klemen
Site Admin
Posts: 10145
Joined: Fri Feb 11, 2005 4:04 pm

Re: Paypal email notifications

Post by Klemen »

Oh, wait - I think I misunderstood you.

The EMAIL address is the correct one, right? Just the "via PayPal" part needs fixing?

To do that:
- open inc/pipe_functions.inc.php in a plain text editor
- find line

Code: Select all

$tmpvar['name'] = hesk_input($tmpvar['name'],'','',1,50) or $tmpvar['name'] = $hesklang['pde'];
- just below that line add

Code: Select all

$tmpvar['name'] = str_replace(' via PayPal', '', $tmpvar['name']);
- save, upload & test
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
J_E_F_F
Posts: 30
Joined: Sun Sep 28, 2014 2:55 pm

Re: Paypal email notifications

Post by J_E_F_F »

that's what I needed, thanks.
Klemen
Site Admin
Posts: 10145
Joined: Fri Feb 11, 2005 4:04 pm

Re: Paypal email notifications

Post by Klemen »

PayPal changed the way they send emails, so this won't work anymore.

It's more complicated now since customer name and email are not in headers anymore. Try this:

1. open inc/pipe_functions.inc.php

2. find line

Code: Select all

$tmpvar['message'] = hesk_input($tmpvar['message'],'','',1);
3. just ABOVE this line add

Code: Select all

if ($tmpvar['name'] == 'PayPal')
{
    if ( ! preg_match('/from ([^)]*)\s*\(mailto\:(.+@.+)\?/U', $tmpvar['message'], $m))
    {
        preg_match('/from ([^)]*)\s\(\s*([^\s]+@[^\s]+)\s+/U', $tmpvar['message'], $m);
    }
    
    // Do we have name?
    if (isset($m[1]))
    {
        $tmpvar['name'] = $m[1];
        $tmpvar['name'] = hesk_input($tmpvar['name'],'','',1,50) or $tmpvar['name'] = $hesklang['pde'];
    }

    // Do we have email?
    if (isset($m[2]))
    {
        $m[2] = trim($m[2]);

        if ( ! preg_match('/[a-zA-Z0-9]/', substr($m[2], -1) ) )
        {
            $m[2] = substr($m[2], 0, -1);

        }

        if (hesk_isValidEmail($m[2]))
        {
            $tmpvar['email'] = $m[2];
        }

        // Email banned?
        if ( hesk_isBannedEmail($tmpvar['email']) )
        {
           return hesk_cleanExit();
        }
    }
}
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
J_E_F_F
Posts: 30
Joined: Sun Sep 28, 2014 2:55 pm

Re: Paypal email notifications

Post by J_E_F_F »

I gave it a try both with and without the earlier line of code, and the same problem remains. The ticket generated is from Name:PayPal and Email:service@paypal.com

I PM'd you a full email header.
Post Reply