PHP simple : PHP tutorial, MySQL tutorial
PHP Tutorial - Free PHP Script

Home | Tutorials | Php vs Node.Js | Web Tools

Send Email to Multiple Persons

Tutorials > Send Email to Multiple Persons

You can send email to mutiple persons in one time. This tutorial shows you in 1 file with a normal form. When you submit, this file will be sent an email immediately to the target emails from your database.

This tutorial require 1 PHP file and 1 table of mySQL database.

  1. email_to_multiple.php
  2. Database "tutorial" and table "email_list" with 3 fields: id(auto_increment), name(varchar, 50), email (varchar, 50) and put some records into this table. (directly by phpMyAdmin) as below;


Source Code

// Check, if submitted.

// Get variables from POST method form.

$sender="[email protected]"; // Your Email here.

echo "Email has been sent to:";

// Connect database

$rs=mysql_query("select * from email_list order by id asc");

// Do while loop to send email.
$mail_from="From:$email n";
$mail_from .="Content-Type: text/html; charset=utf-8 n";


// Show sent emails.
echo "$row[email]<br>";

// Do following codes if not found "Submit" value.(Not submitted)

<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<form action="<? echo $PHP_SELF; ?>" method="post" name="form" id="form">
<td align="right">Subject : </td>
<td><input name="email" type="text" id="email" /></td>
<td align="right" valign="top">Note : </td>
<td><textarea name="comment" cols="60" rows="5" id="comment"></textarea></td>
<input type="submit" name="Submit" value="Send Email" />
<? } ?>

Put Ebay RSS Feeds onto your website
SEO Elite Software
Domain Dashboard CPanel & Seo Manager
Work at Home Ideas and Opportunities
Introduction & Get Start
Using Form
PHP Tags
PHP Variables
PHP Control Structures
Create Database & Table
Database Connection
Insert Record
Select Record
Update Record
Delete Record
[email protected]