Automatic PayPal Payment Email Response
When someone makes a payment (purchase, donation, whatever), PayPal sends an email to the person who got paid. If you have a PayPal account where you receive money, you know what these look like.
Today, I'll show you how to set up an automatic response to payment received notification email from PayPal.
No more will you need to get your email every few minutes to attend to the purchase in case someone bought something. Think of all the time you'll save and all the extra work you'll get done because you don't have to keep watching for incoming PayPal email.
Some things that can happen automatically when a PayPal email is received:
-
A "thank you" email can get sent to the payer. The email can be HTML or plain text. Say anything you want to say. For example, how-to information or download instructions can be included or, those can be sent in a separate email.
-
One or more attachments can be sent by email. This might be a purchased product, a free bonus, or a surprise gift (as examples).
-
Record the payer's name and email address (and other information) in a CSV or other plain text database file.
-
Send the payer's name and email address to another autoresponder for follow-up and/or to an email list server for regular mailings. The information can be sent by email or by GET or POST submission directly to the autoresponder/list server software.
A Bcc can be sent to yourself with any outgoing email from this system. Software monitoring in this way can alert you to problems you might otherwise be ignorant of.
You'll undoubtedly think of other things you will want to do. Read on.
How It Works
A 2-sentence description: A script extracts payment data from PayPal email and sends it to Master Form V4. Then Master Form V4 does the auto-response stuff.
A synopsis:
Email received for the address where PayPal sends your payment received notification is forwarded to a script. That script is provided with this article.
When the PayPal email handling script provided with this article receives a copy of the email, it extracts payment data and sends the information to Master Form V4. It is sent to Master Form V4 as if it was submitted from a regular web page form.
Anything Master Form V4 can do with information from a form submission, it can also do with the PayPal payment data. And that's a lot of things, as you'll realize when you scan the user's manual.
Master Form V4
If you don't already have this awesome software, it can be obtained at /master/formV4/
The user's manual describes how to send email, HTML or plain text, with or without attachments. It describes how to append information to a CSV or other plain text data file, and how to submit information to other software anywhere on the Internet. It's a large manual that addresses every feature built into Master Form V4.
Note: To work with the system described in this article, Master Form V4 can not have automatic submission protection turned on.
If you need or want automatic submission protection for your web page forms, and you also want to use this PayPal email auto-response system, the solution is to make another installation. Make the second installation on the same domain, but in a separate subdirectory. Then use the first installation for your web page forms and the second installation only for the PayPal email autoresponder system.
It seems with Master Form V4 there is always a way to get the job done.
The PayPal Email Handling
The PayPal email handling script constructs a simulation of form fields from the information in the PayPal email. It then submits it to Master Form V4.
Copy the script and paste it into a plain text word processor (you'll be making some edits). Save the script as paypalemail.cgi or another file name that makes sense to you.
The edits are clearly marked in the script. You'll be specifying:
-
The domain name where the software is installed.
-
Optionally, if you want to be notified in case of anomalies, the server's sendmail location and your email address.
-
The URL to your installation of Master Form V4.
-
A form field name whose value will contain the PayPal payment data.
-
Optionally, separate form field names for specific PayPal information, like email address and buyer's name. (Minimally, the email address in a separate form field is required for Master Form V4 to automatically send email to the buyer.)
-
The hidden form fields you would be using if the PayPal email handling script was actually a real form.
Then install the script like you would any CGI program upload with FTP as a plain text file and give the script 755 permissions.
The PayPal email handling script can be located on a different domain than where Master Form V4 is installed, just like web page forms can be located on a different domain.
Forwarding Email To the PayPal Script
If you have cPanel, go to the email forwarding page and make a forwarder for the email address where PayPal sends your payment received notifications.
For the email destination field, specify the location of perl and the PayPal email handling script, piped and quoted. Example:
"|/usr/bin/perl /full/path/to/paypalemail.cgi"
"Quoted" means there are quotation marks at the beginning and the end of the destination.
"Piped" means the first character after the quotation mark is a vertical bar character, also known as a pipe character. This means simply that, were you to visualize it, the email will be sent to the destination as through a pipe.
The location of perl and the script immediately follow the pipe.
The location of perl is the same location you have on the first line of Perl CGI scripts, minus the leading "#!". The location of the script is the full server path to where it is installed. The perl and script locations are separated with a space.
It looks geeky. But it's also easy once you've done it.
When I set up a forwarder like this, I open my plain text word processor and type the destination into it. Then I can double-check it before copying and pasting into the destination field.
As set up through cPanel, when the email is forwarded to the script, just a copy is forwarded. Any other destinations that had been receiving the email will still receive the email.
If you don't have cPanel, ask your hosting company, "How do I set up forwarding to a script all email arriving for a certain email address." I've found that most hosting companies have a way to do that.
Implementation
1.
Install Master Form V4, if you haven't already.
2.
Create the templates you'll want to use when Master Form V4 processes the information obtained from PayPal email. Use placeholders (see the user's manual) to insert certain PayPal-provided information into emails and data records.
3.
Install the PayPal email handling script.
4.
Set up forwarding to send a copy of PayPal payment received notification emails to the PayPal email handling script.
5.
Test the system to verify it works okay.
You now have a system that automatically responds to payment received notification email sent by PayPal.
That response can employ any one or more of the many features inherent in Master Form V4.
Sleep well.
Question:
Did you find this article interesting and understandable? How can it be improved?
Your response is anonymous.
When done typing, click anywhere outside the box. [more info]
Will Bontrager
©Copyright 2007 Bontrager Connection, LLC Bontrager Connection, LLC
Please note:
Articles on this website are presented "as is". However -
If you have a question about a CGI script, HTML, CSS, PHP, or JavaScript
Ask one of our Experts and you'll have your answer!
Click here for details.