1. Technology

How to submit a form to multiple email addresses

By January 11, 2008

Follow me on:

Question?
GVB2WEB (Ginger) asks:

I have been working at learning HTML and web design for a year now. I am frustrated with a form on a site that I have taken over maintenance of. I know nothing of programing CGI or PHP but I know that they work with the processing of web forms. I have a form that I would like to have submitted to multiple e-mails at the same time. Is that possible? If so, how do I do it?

My Thoughts
Forms are very challenging, especially for designers who don't know programming. The easiest way to write a form and send it to multiple people is to use a mailto form and use that to send it to multiple people. Put multiple email addresses in the action field by separating them with a comma:

<form action="mailto:email@address1.com,email@address2.com"> ... </form>

There are lots of resources on learning to build HTML forms and make them work with CGI and other scripts on this site:

How would you help Ginger?
Would you recommend she learn to write Perl or PHP? Or is there some script that you found really easy to use? If you have suggestions for her, you can post them in the comments or reply in the forum.

Comments
January 11, 2008 at 11:33 am
(1) Nick says:

For PHP probably the best mailer out there is called ‘PHP Mailer’.
http://phpmailer.codeworxtech.com/examples.html

Basically to create a mailer you do something like this….

require(“class.phpmailer.php”);

$mail = new PHPMailer();

$mail->From = “list@mydomain.com”;
$mail->FromName = “List manager”;
$mail->Body = $body;
$mail->AddAddress(‘first_email@jkl.com’,'second_email@jkl.com’);

if(!$mail->Send()) { echo “oops didn’t send something is broken”;}

So then basically if you need to put variables in there from the form you create a form and submit it to a file that has the code above in it such as process_form.php and then redirect to a thank you page.

April 7, 2010 at 4:47 am
(2) dele says:

please i have created a form and i need to get the form data submitted to an email. i’ve tried the mailto:yourname@yourdomain but it brings me outlook to start filling in data again. I just need the form to get submitted to an email after clicking the submit button. please i do i do that?

April 13, 2010 at 9:56 pm
(3) MSOL Simple Solutions says:

Hello Dele, if you are just needing a simple HTML form, try this: HTML Comment Box Generator. This code should give you a general idea. You can further adust the code (input boxes, etc.) to suit your needs. (P.S. Use a Windows browser to be able to preview your code.) Take care!

October 3, 2010 at 11:50 pm
(4) matauwai says:

i am writing an online shopping form and would like to have it send to my business email address directly after my customer hits the submit botton. i don’t want to use mailto function.

February 25, 2011 at 10:01 am
(5) web designer says:

Thank you for writing this post. Help me a lot with the custom forms I created on my site.

Leave a Comment

Line and paragraph breaks are automatic. Some HTML allowed: <a href="" title="">, <b>, <i>, <strike>

©2014 About.com. All rights reserved.