473,394 Members | 1,956 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,394 software developers and data experts.

How to send mail to multiple emails at once with mail() function

2
Please, guys. I really need your help with this because i have tried every means i know but all to no avail. Thanks
Jan 29 '11 #1
4 2437
Dormilich
8,658 Expert Mod 8TB
you specify additional receivers in the mail headers, i.e. the CC and BCC headers.
Jan 30 '11 #2
Yorme
2
Thanks dude. But how do i include d bcc, cc in d function. Write an example for me to see
Jan 30 '11 #3
Dormilich
8,658 Expert Mod 8TB
examples how to add headers are given here.
Jan 30 '11 #4
Niheel
2,460 Expert Mod 2GB
As dormilich pointed out there's a nice example of how to add BCC and CC to your PHP mail code:

taken from php.net mail fucntion page:

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. // multiple recipients
  3. $to  = 'aidan@example.com' . ', '; // note the comma
  4. $to .= 'wez@example.com';
  5.  
  6. // subject
  7. $subject = 'Birthday Reminders for August';
  8.  
  9. // message
  10. $message = '
  11. <html>
  12. <head>
  13.   <title>Birthday Reminders for August</title>
  14. </head>
  15. <body>
  16.   <p>Here are the birthdays upcoming in August!</p>
  17.   <table>
  18.     <tr>
  19.       <th>Person</th><th>Day</th><th>Month</th><th>Year</th>
  20.     </tr>
  21.     <tr>
  22.       <td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
  23.     </tr>
  24.     <tr>
  25.       <td>Sally</td><td>17th</td><td>August</td><td>1973</td>
  26.     </tr>
  27.   </table>
  28. </body>
  29. </html>
  30. ';
  31.  
  32. // To send HTML mail, the Content-type header must be set
  33. $headers  = 'MIME-Version: 1.0' . "\r\n";
  34. $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
  35.  
  36. // Additional headers
  37. $headers .= 'To: Mary <mary@example.com>, Kelly <kelly@example.com>' . "\r\n";
  38. $headers .= 'From: Birthday Reminder <birthday@example.com>' . "\r\n";
  39. $headers .= 'Cc: birthdayarchive@example.com' . "\r\n";
  40. $headers .= 'Bcc: birthdaycheck@example.com' . "\r\n";
  41.  
  42. // Mail it
  43. mail($to, $subject, $message, $headers);
  44. ?>
Jan 30 '11 #5

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

Similar topics

15
by: news.microsoft.com | last post by:
HI, ASPEmail to send to multiple recipients? I tried to use comma and semicolon but all the time give this message error: Error: 6 - 501 Bad address syntax nor :...
3
by: Dave | last post by:
I have been reading everything i can find regarding sql mail and sql agent mail. We have a win2k server, sql 2000 and NO, NO, NO exchange server(all up to date on service packs). I have tried...
2
by: Brad | last post by:
I have a web .Net app which sends emails with attachments. After the email is sent I clean up aftermyself and delete the attachments from disk. In upgrading to .Net 2 I changed the email logic...
10
by: ll | last post by:
Hi, I currently am using the following regex in js for email validation, in which the email addresses can be separated by commas or semicolons. The problem, however, lies in that I can type two...
10
by: crazycooter | last post by:
I found an old thread on this (http://groups.google.com/group/alt.php/ browse_thread/thread/751edb9c723316c4/ea9bf92a9c6b807c?lnk=gst&q=mail() +duplicate&rnum=7#ea9bf92a9c6b807c), but there didnt...
3
by: shybe | last post by:
I have a send mail script on my site that. The emails are recieved by gmail, and yahoo, but not to mail clients like Outlook, Mail, etc...) Is this a problem with the script, or is it...
2
by: palanisiva | last post by:
Hi, I am using PHP mailer to send out 2 different emails. The problem I am having is only the first email is ever sent out. Below is my code. The first email $to but i add two mail id mail not...
1
by: Graham2107 | last post by:
I have a small database of people who wish to be placed on a mailing list. I have stored the usual parameters like firts name, last name, email address etc. How do I read from the database and...
0
by: rserrador | last post by:
Hello. I'm creating a db in access 2007 and i want to have a buton on a report where i can send bcc multiple emails from a query. Can someone help me with the VBA code please.
11
by: londres9b | last post by:
I want to send multiple emails from php with one unique script. The emails are from a mysql database table. How can I achieve this?
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.