Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8876991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T19:21:21+00:00 2026-06-14T19:21:21+00:00

I just want to send multiple email to the recipients using mail() when i

  • 0

I just want to send multiple email to the recipients using mail() when i update the order status to notify the customers. (Im using my own email as testing, and each of the order from 1 to 10 is my email.)
So im suppose to receieved more than one email to myself..
But when i did it, i receieved only one email and inside that email at the “to” section, its display my email 10 times !! (to ahmadxxx@hotmail.com, ahmadxxx@hotmail.com, ahmadxxx@hotmail.com … )

This is my form.

<form action="results-action" method="post" enctype="multipart/form-data">
<fieldset>


<table id ="table_id" class="display">

<thead>

<tr><td><h2>Pending Order</h2></td></tr>

<tr>
<th scope="col">Order ID</th>
<th scope="col">Order Number</th>

<th scope="col">Name</th>

<th scope="col">Address</th>

<th scope="col">Payment Method</th>

<th scope="col">Order Date</th>
<th scope="col">Product Name</th>
<th scope="col">Produt Quantity</th>
<th scope="col">Price</th>
<th scope="col">Order status</th>
</tr>
</thead>

<tbody>

<?php 
while ($row = mysqli_fetch_array($result)) {
?>

<tr>
<td><input type="text" value='<?=$row['virtuemart_order_id']?>' name="orderid" id="virtuemart_order_id"></td>

<td><?=$row['order_number']?></td>
<td><?=$row['first_name']?></td>
<td><?=$row['address_1']?></td>

<td><?=$row['payment_element']?></td>
<td><?=$row['created_on']?></td>

<td><?=$row['order_item_name']?></td>

<td><?=$row['product_quantity']?></td>

<td><?=$row['product_final_price'] ?></td>
<td><select name='change[<?=$row['virtuemart_order_id']?>]'>
<option value='C'> Confirmed</option>

<option value='X'> Cancelled</option></select></td>
</tr>

<?php
}
?>

</tbody>
</table>
</fieldset>



<fieldset>
<table>
<tr>
<td><input type="submit" value="Update status" name="update status"> </td>
</tr>
</table>
</fieldset>



</form>

This is my codes.

<?php

//filtering confirmed orders

function confirmed($v){return($v =='C');}



// pick the rows in your form table which have been set as confirmed, and use the keys

$id = implode(',', array_keys(array_filter($_POST['change'],'confirmed')));

// build SQL statement mail
$query3 = "SELECT * from ruj3d_virtuemart_order_userinfos where virtuemart_order_id IN (".$id.")";



// execute SQL statement
$result3 = mysqli_query($link, $query3) or die(mysqli_error($link));







while($row3 = mysqli_fetch_array($result3)){
$addresses[]=$row3['email'];


}

$to = implode(", ",$addresses);

$subject = "Order confirmed by Home and decor";



// message
$message = '

<html>
<body>
<table width="500" height="215" border="0">
<tr>
<th width="238" height="211" scope="col"><h1 align="left">Order # 1234</h1></p></th>
<th width="10" scope="col"></th>
<th width="243" scope="col"><p><img src="file:///D|/Programs/xampp/htdocs/images/sitelogo.PNG" width="224" height="68" align="right"></p></th>
</tr>
</table>

<table width="500" height="215" border="0">
<tr>
<th width="181" height="211" scope="col"><p align="left">Ship To:</p>
<p align="left">Customer name</p>
<p align="left">Blk 123</p>
<p align="left">Singapore, 123123</p></th>
<th width="80" scope="col"></th>
<th width="40" scope="col"></th>
<th width="181" scope="col"><p align="left"></p>
<p align="right">Bill To:</p>
<p align="right">Customer name</p>
<p align="right">Blk 123</p>
<p align="right">Singapore, 123123</p>
</th>
</tr>
</table>

<table width="500" height="94" border="0">
<tr>
<th height="43" scope="col"><div align="left">Order Date:</div></th>
<th scope="col">&nbsp;</th>
<th scope="col">&nbsp;</th>
<th scope="col"><div align="right">Shipping Method:</div></th>
</tr>
<tr>
<th width="126" height="43" scope="col"><div align="left">1/11/13</div></th>
<th width="433" scope="col">&nbsp;</th>
<th width="103" scope="col">&nbsp;</th>
<th width="156" scope="col"><div align="right">BEAST!</div></th>
</tr>
</table>
<table width="500" height="88" border="1">
<tr>
<th width="48" scope="col">Item</th>
<th width="264" scope="col">Product Name</th>
<th width="68" scope="col">Quantity</th>
<th width="92" scope="col">Price</th>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
<hr>
<table width="500" height="227" border="0">
<tr>
<th height="43" scope="col">&nbsp;</th>
<th scope="col">&nbsp;</th>
<th scope="col">Subtotal:</th>
<th scope="col">&nbsp;</th>
</tr>
<tr>
<th height="43" scope="col">&nbsp;</th>
<th scope="col">&nbsp;</th>
<th scope="col">Tax:</th>
<th scope="col">&nbsp;</th>
</tr>
<tr>
<th height="43" scope="col">&nbsp;</th>
<th scope="col">&nbsp;</th>
<th scope="col">Shipping:</th>
<th scope="col">&nbsp;</th>
</tr>
<tr>
<th height="43" scope="col">&nbsp;</th>
<th scope="col">&nbsp;</th>
<th scope="col">Discount:</th>
<th scope="col">&nbsp;</th>
</tr>
<tr>
<th width="40" height="43" scope="col">&nbsp;</th>
<th width="278" scope="col">&nbsp;</th>
<th width="68" scope="col">Grand Total:</th>
<th width="96" scope="col">&nbsp;</th>
</tr>
</table>
<p align="right">&nbsp;</p>
</body>
</html>

';



// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

mail($to, $subject, $message, $headers);


?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T19:21:22+00:00Added an answer on June 14, 2026 at 7:21 pm

    You need to move the code that composes and sends the mail inside the

    while ($row3 = mysqli_fetch_array($result3)) {
    ...
    }
    

    loop, instead of making an array of all the addresses.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to send multiple attachments but not declaring them just octet-stream doing it
I just want to transfer (send or receive) a hash from client to server.
Just want to know if publishing an application on Google play is allowed using
How can I send and receive multiple inputs using Runtime.getRunTime.exec(). For example if I
I am using WCF with duplex netTcpBinding and I want to send a message
I am currently investigating using NServiceBus to solve the following problem. I just want
Possible Duplicate: Possible to send automated email? This question has been asked in multiple
Just want to ask if i can use Custom Validator in client side without
Just want to make sure one thing. In a windows machine (either a desktop
Just want to know how to read an attribute of a parent node from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.