473,225 Members | 1,326 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,225 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 3382
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...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

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.