Page 1 of 1
Paypal email notifications
Posted: Sun Sep 28, 2014 3:07 pm
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
Re: Paypal email notifications
Posted: Sun Sep 28, 2014 3:53 pm
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
Re: Paypal email notifications
Posted: Sun Sep 28, 2014 4:14 pm
by J_E_F_F
Worked perfectly, thank you.
Re: Paypal email notifications
Posted: Sun Mar 01, 2015 3:03 pm
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?
Re: Paypal email notifications
Posted: Sun Mar 01, 2015 3:24 pm
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?
Re: Paypal email notifications
Posted: Sun Mar 01, 2015 6:27 pm
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.
Re: Paypal email notifications
Posted: Sun Mar 01, 2015 7:54 pm
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
Re: Paypal email notifications
Posted: Sun Mar 01, 2015 10:34 pm
by J_E_F_F
that's what I needed, thanks.
Re: Paypal email notifications
Posted: Mon Nov 14, 2016 9:55 am
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();
}
}
}
Re: Paypal email notifications
Posted: Mon Nov 14, 2016 3:02 pm
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.