HTML直接发送邮件

发布网友

我来回答

2个回答

热心网友

**subject: 要发送的邮件主题*/function SendEMail(infor, subject){var jMail = new ActiveXObject("Jmail.message");jMail.Silent = true;jMail.Charset = "utf-8";jMail.FromName = "sender" //发件人jMail.From = "anxingyu_1984@126.com"; //发送人的邮件地址jMail.AddRecipient("axy_1984@126.com"); //收件人的邮件地址// jMail.Subject = subject;// jMail.Body = infor;jMail.Subject = "test";jMail.Body = "tests";jMail.MailServerUserName="anxingyu_1984@126.com";jMail.MailServerPassWord="密码";var ret = jMail.Send("smtp.126.com");if(ret == false){alert("fail");}else{alert("success");}jMail.Close();}</script</BODY</HTML注册组件:jmail.dll jmail组件,版本:4.4,安装方法:将其复制到system32目录下,在MS-DOS下执行regsvr32 Jmail.dll即可网上下了个包,提供了很多组件,运行aaaa.bat即可,aaaa 只注册JMail.dll
希望能解决您的问题。

热心网友

简单的PHP留言板制作
是这两天自己摸索PHP写出来的。

纯粹只有留言功能。
简单的php留言板进阶。带管理
http://jingyan.baidu.com/article/ff4116257ec55112e48237f8.html
工具/原料
DW \EditPlus
php、mysql服务器

步骤/方法
首先是确定自己的留言板需求.例如:名字,邮件及留言内容.
一. 建立一个数据库guestbook。

CREATE TABLE IF NOT EXISTS `content` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(20) NOT NULL,
`email` varchar(50) NOT NULL,
`content` varchar(200) NOT NULL,
PRIMARY KEY (`id`))
ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=3;
二. 新建config.php

<?php
$q = mysql_connect("服务器","数据库用户","数据库密码");
if(!$q)
{
die('Could not connect: ' . mysql_error());
}
mysql_query("set names utf8"); //以utf8读取数据
mysql_select_db("guestbook",$q); //数据库
?>
三.新建index.php
<?php
include("config.php"); //引入数据库连接文件
$sql = "select * from content"; //搜索数据表content
$resule = mysql_query($sql,$q);
?>
<html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<body>
<table width="678" align="center">
<tr>
<td colspan="2"><h1>留言本</h1></td>
</tr>
<tr>
<td width="586"><a href="index.php">首页</a> | <a href="liuyan.php">留言</a></td>
</tr>
</table>
<p>
<?
while($row=mysql_fetch_array($resule))
{
?>
</p>
<table width="678" border="1" align="center" cellpadding="1" cellspacing="1">
<tr>
<td width="178">Name:<? echo $row[1] ?></td>
<td width="223">Email:<? echo $row[2] ?></td>
</tr>
<tr>
<td colspan="4"><? echo $row[3] ?></td>
</tr>
<tr>
</table>
<?
}
?>
</body>
</html>
四.新建liuyan.php
<html>
<body>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<table width="678" align="center">
<tr>
<td colspan="2"><h1>留言本</h1></td>
</tr>
<tr>
<td width="586"><a href="index.php">首页</a> | <a href="liuyan.php">留言</a></td>
</tr>
</table>
<table align="center" width="678">
<tr>
<td>
<form name="form1" method="post" action="post.php">
<p>
Name:
<input name="name" type="text" id="name">
</p>
<p>Email:<input type="test" name="email" id="email"></p>
<p>
留言:
</p>
<p>
<textarea name="content" id="content" cols="45" rows="5"></textarea>
</p>
<p>
<input type="submit" name="button" id="button" value="提交">
<input type="reset" name="button2" id="button2" value="重置">
</p>
</form>
</td>
</tr>
</table>
</body>
</html>
五. 新建post.php
<?php
header("content-Type: text/html; charset=utf-8");
include("config.php");
$name= $_POST['name'];
$email= $_POST['email'];
$patch = $_POST['content'];
$content = str_replace("
","<br />",$patch);
$sql = "insert into content (name,email,content) values ('$name','$email','$content')";
mysql_query($sql);
echo "<script>alert('提交成功!返回首页。');location.href='index.php';</script>";
?>
这样已经成功的写出一个留言板了。
注意事项
数据库最好是使用utf8,我上面写的就是用utf8的。
输入和输出,要使用同一种编码,否则会出现乱码。
软件基本信息

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com