This topic is locked

E-Mail multiple recipients and have reply to all

11/9/2019 11:17:17 AM
PHPRunner General questions
D
david22585 author

Piggy backing off a previous code that used to work that no longer works properly at https://asprunner.com/forums/topic/26421-email-from-database-but-cc-all-the-emails/
The e-mail gets sent to everyone from my database, but it doesn't show all the e-mails that it was sent to. I need this to happen so when someone who gets the e-mail, they can click Reply to all and everyone will get the reply back. As it works now, the e-mail it sent to member 1, 2, 3, 4, and 5. When it's received, each e-mail is received individually and when hitting reply, it will only be sent to the person who submitted the form and not member 1-5. Here is the code I'm using:



global $dal;

$email="";

$tblUsers = $dal->Table("bod_members");

$rs = $tblUsers->QueryAll();

while ($data = db_fetch_array($rs))

{

$email.=$data["email"].",";

}

$email=rtrim($email,',');
$from="WorkOrder@website.co";

$fromName="Work Order System";

$msg="";

$subject="Work Order Request";
$msg.= "<html><body> e-mail is truncated to save space. HTML e-mail is what's sent";
$ret=runner_mail(array('to' => $email, 'subject' => $subject, 'htmlbody' => $msg, 'fromName'=> $fromName, 'from'=>$from, 'replyTo' => $values["email_address"]));

if(!$ret["mailed"])

echo $ret["message"]."
";


The values of email is the 5 members that should be getting the email. The value of email_address is the email of the user submitting the form. When the email is received and reply to all is hit, it should show both the values of all the email and email_address fields. Right now, it only shows the "email" of the person receiving it, and they can reply to the person with the email_address. Just trying to see if I;m missing anything in the code that used to work.

Sergey Kornilov admin 11/9/2019

I would suggest experimenting with this using a regular email client and once you figured out correct settings i.e. what goes to TO and what goes to REPLYTO you can make changes to your code. You also need to remember that Reply All behavior depends on the email client you using and different email software may act differently.