Sourceofarticles.com Menu
Newest Articles
Most Viewed Articles
Sourceofarticles.com RSS
Submit Article
Login
Signup
Search the articles

Articles Main Categories
Advice
Animals
Automobiles
Business
Career
Communications
Computer Programming
Computers
Entertainment
Environment
Family
Fashion
Finance
Food
Health & Medical
Home & Garden
Humor
Internet Business
Internet Marketing
Legal
Leisure & Recreation
Marketing
Other
Politics
Reference & Education
Religion
Self Improvement
Sports
Technology & Science
Travel
Writing
Subscribe
Receive alert message from us when new articles submitted to our site for free.

Enter your name

Enter your email

Syndicate

















Related Products
NIKE Dri-Fit Running Cycling Baseball Hat Cap Unisex
US $12.99 (0 Bid)
End Date: Friday Nov-21-2008 15:06:47 PST
Buy It Now for only: US $14.99
Bid now | Buy it now | Add to watch list

New LOUIS GARNEAU Downhill Cycling Jersey Long Sleeve S
US $19.99 (0 Bid)
End Date: Friday Nov-21-2008 15:08:42 PST
Buy It Now for only: US $22.99
Bid now | Buy it now | Add to watch list

New Team Highroad Columbia Road Cycling Hat Cap Apparel
US $9.99 (1 Bid)
End Date: Friday Nov-21-2008 15:08:55 PST
Bid now | Add to watch list

New Team Highroad Columbia Road Cycling Hat Cap L-XL
US $9.99 (0 Bid)
End Date: Friday Nov-21-2008 15:17:43 PST
Bid now | Add to watch list

Verge cycling vest 2XL used
US $14.99 (1 Bid)
End Date: Friday Nov-21-2008 15:18:41 PST
Bid now | Add to watch list

SHIMANO SH-M032 CYCLING SHOES 42
US $9.99 (0 Bid)
End Date: Friday Nov-21-2008 15:21:21 PST
Bid now | Add to watch list

Tour de France VAL D'ISERE 2007 Cycling Poster Print
US $29.94 (0 Bid)
End Date: Friday Nov-21-2008 15:27:21 PST
Buy It Now for only: US $29.99
Bid now | Buy it now | Add to watch list

Ladies Bicycle Cycling & Running Shirt Exercise Jersey
US $42.00 (0 Bid)
End Date: Friday Nov-21-2008 15:30:00 PST
Bid now | Add to watch list

21 LED Bike Bicycle Front Lamp+Cycling 5 LED Rear Light
US $8.89
End Date: Friday Nov-21-2008 15:30:43 PST
Buy It Now for only: US $8.89
Buy it now | Add to watch list

Running, Cycling, Workout, Weight Training Log Software
US $19.99 (0 Bid)
End Date: Friday Nov-21-2008 15:33:00 PST
Buy It Now for only: US $24.99
Bid now | Buy it now | Add to watch list

MENS FRANCE CYCLING SKINSUIT
US $9.99 (0 Bid)
End Date: Friday Nov-21-2008 15:36:26 PST
Buy It Now for only: US $25.00
Bid now | Buy it now | Add to watch list

Home::CGI

Autoresponders With PHP

Author : Robert Plank

First off, check out the URL below. You'll learn how to make
that today. http://www.jumpx.com utorials/3/signup.html

Fill out your e-mail address on the page you see. (I promise
it's not being saved anywhere.) Then, wait a minute or two and
check your mail. You should get a message from Gumby
(null@jumpx.com) containing a sample autoresponder message.

Today, we're going to learn three easy things: redirection, mail
sending, and form submission.

When we finish with that, you will know how to put those
components together and create an autoresponder. Because if you
think about it, that's all an autoresponder does. Somebody
enters in their e-mail address, are sent an e-mail message, and
then are redirected to a new page.

Of course there are more complex autoresponders, like Gary
Ambrose's Opt-In Lightning, or Wes Baylock's Mail Master Pro
which handle multiple follow-ups and record the e-mail addresses
of those who have signed up for the responder. But today we're
just going to focus on how to make a very basic, very simple
autoresponder.

Hopefully, you've seen what form objects in HTML look like.
Here's some code you can use for an example:

Enter Your E-Mail
Address:



Copy and paste this code into a file called "signup.html" and
upload it to your web server. You'll see a text box waiting for
your visitor to enter his or her e-mail address so they can be
sent that autoresponse message.

Of course, the form won't work just yet because, if you look at
the first line of that HTML code I gave you, you'll see that the
form submits to a script called "some-script.php". And we
haven't made that just yet.

Look on the second line of "signup.html", at the last half of
the line. You should be familiar with HTML tags, but if you're
not, an HTML tag consists of two parts: the parent tag and the
attributes.

The parent tag is simply the tag's designation. For example, if
you had a slice of HTML code that looked like this:



Then the parent tag would be "font". The rest of what's enclosed
in the tag tells the browser what to do with it. For example, in
this tag the attributes are that the font should be Verdana with
size 1.

Why am I telling you all this? Because it relates to the HTML
code you see in signup.html.

Now, when you look at this: size="30">

The code tells the receiving browser that this is an "input"
tag, meaning that it's a form field. The name of this item is
"email" and its size is 30, meaning this text box should be 30
characters in width.

When the form is submitted, it takes all the values of all the
fields inside that form and throws it at its destination. In
this case, our destination is "some-script.php".

If you're lost, this will all make a whole lot more sense once
you try this next step.

Make a file called "some-script.php" and paste this line of code
into it:



Upload the script in the same folder as signup.html, and go to
"signup.html". Type your e-mail address in and click the submit
button.

You should see a new page containing just your e-mail address
and nothing else.

Is this starting to make sense? You told the PHP script to dump
the contents of the variable called "email" to the screen, and
you just submitted a form with a text box called "email".

If you want to try one more exercise like this, change the name
of the text box to, say, "goober" in signup.html and change the
$email in some-script.php to $goober. Upload both, go to
signup.html, and type anything into the text box. You'll get the
same result.

This is how you'll pass data from forms (like text fields, drop
down menus, radio buttons and the like) along into the PHP
scripts you create.

We've just covered how to submit form elements into PHP. Now
let's focus on sending mail.

PHP has a really simple function that uses whatever mail sending
program is installed on your server to send messages to the
outside world. If you have a crappy web server, this step might
not work and you'll have to use a different web host if you want
to try this.

But if you're on a good web host that has PHP installed
*correctly*, this shouldn't be a problem.

Up until now we haven't used functions in PHP too much, aside
from simple things like include() and header(). Today's your
lucky day, because functions work in a very similar way to HTML
tags. You have the parent tag, and the attributes (or
parameters).

The mail() function basically works like this:

mail("recipient","subject","body","headers");

Let's start off by sending a simple e-mail message to yourself.
We won't need any special headers this time around, so this will
be quick and painless. Copy this one line of code into
"mailtest.php":

billg@microsoft.com","Hello","Hi. This is the body
of my message."); ?>

Replace "billg@microsoft.com" with your actual e-mail address,
but be *sure* to keep quotes around it. Save it, and upload
mailtest.php to your web server and run it in the browser. You
should see a blank page. Wait a few minutes and check your mail.
You should see a mysterious mail message in your box with the
subject "Hello" and the message "Hi. This is the body of my
message."

If you're using a free e-mail service or a weird ISP, the
message won't come through because a lot of mail servers these
days require that certain headers are present in the message.

Let's do that now.

What's below isn't important enough to explain thoroughly, but
it's just header information that is interpreted by the mail
server. This data tells us that we're sending a plain text
e-mail, that the message came from your e-mail address (and
gives your name), and tells us that the e-mail "client" we used
was PHP.

$headers = "Content-Type: text/plain; charset=us-ascii From:
$myname <$mymail> Reply-To: <$mymail> Return-Path: <$mymail>
X-Mailer: PHP";

This is the code you should have by this point, complete with
the header information and the variables which tell the script
what your name and e-mail address are:


$email = "billg@microsoft.com";

$myname = "Your Name Here"; $mymail = "your@email.here";

$headers = "Content-Type: text/plain; charset=us-ascii From:
$myname <$mymail> Reply-To: <$mymail> Return-Path: <$mymail>
X-Mailer: PHP";

mail($email,"Hello","Hi. This is the body of my
message.",$headers);

?>

Notice how we've simplified things a bit by using variables in
the mail() function. That way we don't have to retype things.
This method also looks better (in my opinion anyway) and is
easier to tweak once you're ready to actually customize it for
yourself.

Try this out again. Believe it or not, but you just made your
first autoresponder! Before we move on let's make this look even
cleaner:


$myname = "Your Name Here"; $mymail = "your@email.here";

$subject = "Hello"; $body = "Hi. This is the body of my message.
Notice how I can continue typing right on the next line!";

$headers = "Content-Type: text/plain; charset=us-ascii From:
$myname <$mymail> Reply-To: <$mymail> Return-Path: <$mymail>
X-Mailer: PHP";

if ($email != "") { mail($email,$subject,$body,$headers); }

?>

All I did here was just make things look nicer, but notice how I
removed the line that set $email to "billg@microsoft.com." This
is because the value of $email will be passed to the script from
that form we made earlier.

This also sends the e-mail message ONLY if the value of $email
is not blank. So if someone just hit the submit button without
entering an address, the script won't try to send the e-mail
message.

Everything should be ready for you to try out now. Re-upload
"some-script.php" and go to signup.html. Enter your e-mail
address in the field, hit submit and wait for that mail message
to arrive.

There's only one step left to making this autoresponder
complete. And that's sending the user somewhere so they aren't
given a blank page.

Find this line in your script: if ($email != "") {
mail($email,$subject,$body,$headers); }

And paste this directly underneath it:
header("Location:http://www.jumpx.com"); die();

Try the autoresponder out. You'll see that once the autoresponse
message is sent, you're directed to www.jumpx.com. Now, go ahead
and change it to whatever URL you want to use. Or, make use it
with a variable so the end result is like this:


$myredirect = "http://www.my-domain-name.com hankyou.html";

$myname = "Your Name Here"; $mymail = "your@email.here";

$subject = "Hello"; $body = "Hi. This is the body of my message.
Notice how I can continue typing right on the next line!";

$headers = "Content-Type: text/plain; charset=us-ascii From:
$myname <$mymail> Reply-To: <$mymail> Return-Path: <$mymail>
X-Mailer: PHP";

if ($email != "") { mail($email,$subject,$body,$headers); }
header("Location:$myredirect"); die();

?>

Don't forget to change the values above.
"http://www.my-domain-name.com hankyou.html" needs to point to
the URL where thankyou.html is stored.

You're done. Don't forget to send John feedback for me. If
you're really curious as to how to do something in PHP, I might
just write an article on it.

Related articles


  1. 5 CGI Scripts You Must Use to Turn Your Site Into a Powerhouse
  2. Clever Profit Growth Software
  3. Why Aren't You Using CGI
  4. Use CGI to Automate Your Web Site
  5. CGI: What the Heck Is That?
  6. CGI Security Issues
  7. How to Stop Digital Thieves with CGI
  8. Quick Intro to PHP Development
  9. Better Writing: What Works and What Doesn't
  10. Password Protection and File Inclusion With PHP
  11. Autoresponders With PHP
  12. Track your visitors, using PHP
  13. PHP On-The-Fly!
  14. PHP and Cookies; a good mix!
  15. Screen scraping your way into RSS
  16. Mastering Regular Expressions in PHP
  17. ASP, CGI and PHP Scripts and Record-Locking: What Every Webmaster Needs To Know
  18. Open Source Scripts
  19. this is a test
  20. An Extensive Examination of the PHP:DataGrid Component: Part 1
  21. PHP:Form Series, Part 1: Validators & Client-side Validation
  22. Design an Online Chat Room with PHP and MySQL
More related feeds
Autoresponders+With+PHPhttp://blogsearch.google.com/blogsearch_feeds?hl=en&q=Autoresponders+With+PHP&ui=blg&ie=utf-8&num=10&output=rssURGENT Autoresponder Repair (PHP, Perl/CGI, Script Installation ...
I have a replicating website that also has an autoresponder built in. I followed instructions to configure But 2 things still do not work. 1) The First follow-up email goes out ok to person who fills Lead-capture page ...

Best autoresponder to deliver e-guides? - Ecademy
We are about to publish our first e-guide and this will be available free from our website. Which is the best autoresponder to collect a name and email address in an online form and then automatically email the e-guide to the website ...

Freelance Project | Backend - client work flow by jrmhan
... admin and autoresponder capabilities. We first need a login area for our site. For new accounts, we want to capture the clients name, email, and their desired password... (Budget: $250-750, Jobs: Linux, PHP, Script Installation, ...

PHP FOLLOW UP AUTORESPONDER - BOTH BASIC AND PRO VERSIONS ...
Our php/mysql scripts - follow up autoresponder, password protection script, click tracking script and free article publishing script Continue here ... 1 Responses. Follow up emails and publishing articles Create and use them for the ...

Autoresponders with PHP
When we finish with that, you will know how to put those components together and create an autoresponder. Because if you think about it, that's all an autoresponder does. Somebody enters in their e-mail address, are sent an e-mail ...

Freelance Project | Embed Encoded Image In Mail
I was using Phplist, but it doesn't work well for me. I would like someone to create something custom for me. This program needs to be written in PHP 5.0. The freelancer will need to know email, SMTP, PHP, and basic networking. ...

Autoresponder-like Script | FreeLance Home Jobs
The requirement is to upgrade an autoresponder php script in order to have the functionality of an online autoresponder service with the ability of giving people sequential autoresponder accounts with username and password. ...

Php follow up autoresponder - both basic and pro versions ...
cheap autoresponder,affordable autoresponder,php autoresponder,email marketing script,basic pro autoresponder. Our php/mysql scripts - follow up autoresponder, password protection script, click tracking script and free article ...

Website for Boat used for chartering by gisail : Graphic Design ...
I need a nice presentation of the boat with some flash, active timetable to help with the chartering request and autoresponders for the requesters… (Budget: $250-750, Jobs: Java, Joomla, PHP, Website Design) ...

How can I set up an autoresponder on my blog?
Home | Programming and PHP | How can I set up an autoresponder on my blog? How can I set up an autoresponder on my blog? Question asked by uzomaeze on November 12th, 2008. No Gravatar. my question has been searched every where possible ...

 


 

© 2008 sourceofarticles.com - All Rights Reserved