473,387 Members | 1,464 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Using Formmail.php and trying to select multiple recipients

Hi! Total "newbie to programming" here.

I'm using Jack's Formmail.php, code at:
http://www.dtheatre.com/scripts/sour.../formmail.phps

and I'm trying to figure out how I can have it send an identical message to
more than one recipient, based on a checkbox selected by the user who
submits the form.
<input type="checkbox" name="email1" value="recipient1" />Recipient 1
<input type="checkbox" name="email2" value="recipient2" />Recipient 2
<input type="checkbox" name="email3" value="recipient3" />Recipient 3

where "recipient[n]" is stored in the script:

"recipient1" = "em****@email.com"
"recipient2" = "em****@email.com"
"recipient3" = "em****@email.com"

If the user checks recipient1 AND recipient3, it would send the message to
both of the above e-mail addresses.

Is there a script out there that could do this better?
Any help you can give me would be very helpful!

Thanks so much,
Maggie


Jul 17 '05 #1
4 3389
I noticed that Message-ID:
<6h*****************@newssvr30.news.prodigy.com> from Maggie Blue
contained the following:
<input type="checkbox" name="email1" value="recipient1" />Recipient 1
<input type="checkbox" name="email2" value="recipient2" />Recipient 2
<input type="checkbox" name="email3" value="recipient3" />Recipient 3

where "recipient[n]" is stored in the script:

"recipient1" = "em****@email.com"
"recipient2" = "em****@email.com"
"recipient3" = "em****@email.com"


Give the checkboxes the same name
<input type="checkbox" name="email[]" value="recipient1" />Recipient 1
<input type="checkbox" name="email[]" value="recipient2" />Recipient 2
<input type="checkbox" name="email[]" value="recipient3" />Recipient 3

then

$mailto=implode(",",$_POST['email'] );
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #2
Geoff Berrow <bl******@ckdog.co.uk> wrote:
<input type="checkbox" name="email1" value="recipient1" />Recipient 1
<input type="checkbox" name="email2" value="recipient2" />Recipient 2
<input type="checkbox" name="email3" value="recipient3" />Recipient 3

where "recipient[n]" is stored in the script:

"recipient1" = "em****@email.com"
"recipient2" = "em****@email.com"
"recipient3" = "em****@email.com"


Give the checkboxes the same name
<input type="checkbox" name="email[]" value="recipient1" />Recipient 1
<input type="checkbox" name="email[]" value="recipient2" />Recipient 2
<input type="checkbox" name="email[]" value="recipient3" />Recipient 3

then

$mailto=implode(",",$_POST['email'] );


Close but not complete since $_POST['email'] doesn't (and certainly
shouldn't) contain the emailadresses.

To compare the _values_ of $_POST['email'] with the _keys_ in
$recipient:

<input type="checkbox" name="email[]" value="0" />Recipient 0
....
<input type="checkbox" name="email[]" value="N" />Recipient N

$recipient[]="em****@example.com"
....
$recipient[]="em****@example.com"

$mailto="";
foreach(array_intersect(array_keys($recipient),arr ay_values($_POST['email']))
as $val)
{
$mailto.=$recipient[$val].',';
}
$mailto=trim($mailto,',');

Jul 17 '05 #3
I noticed that Message-ID: <42***********************@news6.xs4all.nl>
from Daniel Tryba contained the following:
$mailto=implode(",",$_POST['email'] );


Close but not complete since $_POST['email'] doesn't (and certainly
shouldn't) contain the emailadresses.

It was late, I was in a hurry...and you have to leave some challenge for
the OP. <g>
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #4

"Geoff Berrow" <bl******@ckdog.co.uk> wrote in message
news:t2********************************@4ax.com...
I noticed that Message-ID: <42***********************@news6.xs4all.nl>
from Daniel Tryba contained the following:
$mailto=implode(",",$_POST['email'] );


Close but not complete since $_POST['email'] doesn't (and certainly
shouldn't) contain the emailadresses.

It was late, I was in a hurry...and you have to leave some challenge for
the OP. <g>
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/


Ooo! How mean! Especially since the OP doesn't know how to read any of that
stuff!
Thanks, everyone; I'll try it out this morning.
-- Maggie Blue
Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: James Hong | last post by:
Help please, I try to sending an email from my html page using the java applet. but it give error on most of the PC only very few work, what is the error i make the java applet show as below ...
2
by: lokisapocalypse | last post by:
I am working on script that sends information from a form to an email account. It worked fine on my campus account but when posting it to the internet and adding the new site to the recipients...
4
by: Hmmm... | last post by:
I am setting up a web site for a friend. Her hosting service does not support Sendmail. It is an NT server. They recommend I use Smtp. I have been using something like formmail.pl when I have...
1
by: Cameron | last post by:
Hi, I've attempted to make use of the Microsoft Knowledge Base Article "ACC97: How to Use a Recordset to Send Outlook E-Mail to Multiple Recipients - 318881" but I can't get it to completely...
2
by: .Net Newbie | last post by:
Hello, I am currently coding my ASP.Net pages in c# and have run into a question concerning Emails. I have four objects on a page (six including 2 buttons). The first is a subject line...
14
by: Mattia | last post by:
I have a very big problem. I must send a single mail to multiple receivers. The number of receivers are very big: approximately 6000 users, but this number increase each year. I find a lot of...
1
by: handokowidjaja | last post by:
Hi All, Several weeks ago i started a topic with the same subject, however the solutions provided was for using MS Outlook (fullblown version). I finally found something that works directly with...
9
by: ARC | last post by:
In case anyone has ran into this yet. The following code used to work with older versions of the MS Outlook library, but would error out in 2007: Dim objOutlook As Outlook.Application Dim...
0
by: blat001 | last post by:
Hi, Not 100% sure if this is the correct group to post in but. I have a class that I want to serialize/deserialize to match the MM7 specifications, which I have done but now that we are...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.