Send an email in an html table

Source: Internet
Author: User
As follows :? /*************************************** * ************************************ Description: thisisasimplescripttosendemailsviaahtml-formtodifferentusersDate:

/*************************************** ***************************************
Description: This is a simple script to send emails via a html-form
To different users
Date:
Author: amalesh kempf


Create this table
The field "what" is for different categories

Create table email_policy (
ID int (11) DEFAULT '0' not null,
What varchar (60) DEFAULT '0' not null,
Name varchar (60) DEFAULT '0' not null,
Email varchar (60) DEFAULT '0' not null,
Timestamp varchar (16 ),
KEY (What ),
Primary key (ID ));

To fill this table you might create an insert form

**************************************** ***************************************/




// Set this values:
$ StrHost = "localhost ";
$ StrUser = "root ";
$ StrPassw = "";
$ StrSender = "you@domain.com ";



If (! $ BtnSendEmail)
{
?>

The email will be added automatically with "Hello Name" in the first line
The emailbody!






}


If (isset ($ btnSendEmail ))
{Echo "Send Email
";

// Create connection
$ IntConID = mysql_pconnect ($ strHost, $ strUser, $ strPassw );

// Header
$ StrHeader = "Return-Path: $ strSender \ nErrors-To: $ strSender \ nFrom:
$ StrSender ";

// SQL
$ StrSQL = "select name, email from email_policy where lcase (what) =
'$ Strwh '";
$ IntRes = mysql_query ($ strSQL, $ intConID );

Echo "Send Email $ strBody
";

// Fetch array
While ($ saRow = mysql_fetch_array ($ intRes ))
{$ StrEmail = $ saRow ["email"];
$ StrName = $ saRow ["name"];
$ StrBodyComplete = "Hello". $ strName [$ I]. "! \ N ". $ strBody;

// Email
Mail ($ strEmail, $ strSubject, $ strBodyComplete, $ strHeader );

// Output
Echo "Send to $ strName
";
}
}
?>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.