通过html表格发电子邮件
更新时间:2006年10月09日 00:00:00 作者:
如下:
/******************************************************************************
Description: This is a simple script to send emails via a html-form
to different users
Date : 1999-02-25
Author : amalesh kempf
Create this table
The field "what" is for different categories
CREATE TABLE email_notify (
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 of
the emailbody!
Subject | |
Body | wrap="PHYSICAL"> echo $strBody ?> |
Category | Party |
type="submit" value="Sende email">
}
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_notify where lcase(what) =
'$strWhat'";
$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\n" . $strBody;
mail($strEmail,$strSubject,$strBodyComplete,$strHeader);
// Output
echo "Send to $strName
";
}
}
?>
相关文章
PHP新手上路(四)...2006-10-10
PHP的缓存数据对更快更好的运行函数是非常有利的。如果一个文件在脚本中测试了多次,你也许会禁止对正确的结果进行缓存。为了实现这点,你可以使用clearstatcache()函数。2010-03-03
php学习笔记 数组遍历实现代码,需要的朋友可以参考下。2011-06-06
理解学习PHP编码规范之注释和文件结构,编写规则的代码与目录结构让大家能快速的熟悉。提高协同工作效率。2010-07-07
基本的 PHP 语法, 学习php的朋友基础入门教程。2009-10-10
如何将一个表单同时提交到两个地方处理...2006-10-10
php中的session完全教程...2007-03-03
nginx+php-fpm配置文件的组织结构介绍,需要的朋友可以参考下2012-11-11
我的论坛源代码(八)...2006-10-10
对于数字索引数组来说,通过 array_push()函数向数组中尾部添加元素,array_unshift头部添加元素,需要的朋友可以参考下2017-04-04
最新评论