PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
1. If I use
$to=$f_email, $f_email_new;
mail($to,$subject,$body_message,$headers);
it gives me parse error like
Parse error: parse error in c:\program files\........php on line ....
2. If I use
Warning: mail(): SMTP server response: 554 User unknown in c:\program files\.....php on line
I am using Argosoft Mail Server (Free). I tried all options but its giving me error all the time. I can send one email successfully but as soon as I use multiple emails,I get errors.
Is it the limitation of Argosoft Mail server free veriosn?? Its just for testing purpose.
I believe that you can only have one email address in the $to parameter. You need to build headers for additional email addresses. The PHP manual for email() shows you how. Or you could use the fantastic Swiftmailer package -- which I believe has passed sliced bread in greatest-thingy-ness.
thanks for your quick reply. Can you please explain little more about it? if you can give me a small example, that would be really appreciated. As a newbie, I am trying to explore mail() function.
I just used the number of mail functions as many times as I have email addresses and it worked fine although its not the best solution but its working for me.
If your looking for a better solution, by all means we will help you explore it. It just may take a little extra effort on your part. Although I definantly would suggest it.
// I assume you would have an array of recipients like:
$recipients = array($f_email, $f_email_new);
// make headers for BCC - this is the part you care about
$headers .= 'Bcc: '.implode(', ',$recipients)."\r\n";
// you have to set something as the "to"
$to = 'me@my.com';
// set the other variables
$subject = "My poodle";
$body_message = 'bark bark bark!';
// send the mail
mail($to,$subject,$body_message,$headers);