By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,614 Members | 1,662 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,614 IT Pros & Developers. It's quick & easy.

Sending e-mail

P: 40
I have created an address book using php and mysql...I have provided check boxes for all my contacts list.Now my requirement is that i just want to check the required contacts and send e-mail to all those checked contacts at once..Is it possible with php?

Thanks
Divya
Sep 18 '08 #1
Share this Question
Share on Google+
1 Reply


ak1dnar
Expert 100+
P: 1,584
If the problem is with getting the check box values;

here is the solution
[html]

<form id="form1" name="form1" method="post" action="mail_script.php">
<input type="checkbox" name="email[]" value="email1@domain.com"/>
<input type="checkbox" name="email[]" value="email2@domain.com"/>
<input type="checkbox" name="email[]" value="email3@domain.com"/>

<input type="submit" name="button" id="button" value="Submit" />

</form>
[/html]

[PHP]
<?php
$mail = $_POST['email'];
var_dump($mail);
?>
[/PHP]

on selecting 1st and 3rd checkboxes, output will be
Expand|Select|Wrap|Line Numbers
  1. array(2) { [0]=>  string(17) "email1@domain.com" [1]=>  string(17) "email3@domain.com" } 
If the problem is with mail function;
You can pass multiple email addresses to php's mail function. read the manual here
http://www.php.net/function.mail

And finally, I highly recommend you to use phpmailer for better performance.
Sep 18 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.