Sending an autoresponder messageAutoresponder message to the person who submitted your form
PHP form
 Home   Forms tutorial   How to articles   Link to us   Donations   Contact 

PHP form > How to > Sending an autoresponder message

Sending an autoresponder message

Want to send an autoresponder message to the person who submitted your form? Maybe you want to just send a confirmation that you received his/her message, maybe some further instructions, doesn't matter.

To send the autoresponder message you obviously need to know the e-mail address of the person submitting the form, so make sure you have a "Your E-mail:" input field in your form! If you are not sure how, go through our PHP forms tutorial first.

Let's say you have the e-mail address stored in $email variable (just like the final form in my tutorial). Now you can send the autoresponder message the same way you would send an e-mail to yourself, just to a different address:

mail($email, "Thank you for your e-mail!",
"Hi, we received your message and will respond within 24 hours!");

Of course you can prepare the message and subject in variables for clearer code. Again, using the final form code we could set it up like:

/* Prepare autoresponder subject */
$respond_subject = "Thank you for contacting us!";

/* Prepare autoresponder message */
$respond_message = "Hello!

Thank you for contacting us! We will get back to you
as soon as possible!

Yours sincerely,

Your name
www.yourwebsite.com
";

/* Send the message using mail() function */
mail($email, $respond_subject, $respond_message);

So, to send an autoresponder message use the PHP mail() function twice inside the code - once to send form result to yourself and the second time to send an autoresponder message to the person who submitted your form.

 


Jump to:  
  2.1 PHP form not working
  2.2 Sending form results to multiple recipients
  2.3 Sending an autoresponder message
  2.4 Make sure form e-mails are not blocked by your SPAM filter
  2.5 Stop form SPAM without using Captcha
  2.6 Which method to use for your form: GET or POST?
  2.7 Contact forms or Help desk software?
  2.8 Prevent multiple form submissions
  2.9 Secure order forms
  2.10 Hosting and PHP forms

Help desk software Hesk

» Copyright notice

© 2008-2024 myPHPform.com. All rights reserved. Copying or redistributing any part of this website without our written permission is expressly forbidden!

Page copy protected against web site content infringement by Copyscape

 


Help desk software

Help myPHPform by Donating!

  Home  Forms tutorial  How to articles  Link to us  Donations  Contact  
 
© Copyright PHP form 2008-2024. All rights reserved.
All trademarks are property of their respective owners.
Privacy policy