ASP提交留言直接发到指定邮箱(二),现有基础修改
如果网站已经在运行了.且留言是保存到数据库的.现在需要修改的.不防看看下边的文章:
这段代码为演示.如现在的网站留言本样式(具体参照自己的):
<table width="600" border="0" align="center" cellpadding="4" cellspacing="1">
<form action="savegb.asp" method="post" name="add">
<tr>
<td>称呼:<input name="name" type="text" id="name"></td>
</tr>
<tr>
<td>电话:<input name="tel" type="text" id="tel"></td>
</tr>
<tr>
<td>标题:<input name="title" type="text" id="title"></td>
</tr>
<tr>
<td><input name="button" type="submit" id="button" value="提交"></td>
</tr>
</form>
</table>
---------------------------------------------------------------------------------------------------------
那么请在您的savegb.asp文件 <% %>中加入如下代码:
代码开始
<%
if request("button")="提交" then
Set msg = Server.CreateObject("JMail.Message")
msg.silent = true
msg.Logging = true
msg.Charset = "gb2312"
msg.ContentType = "text/html" '邮件的格式为HTML的
msg.MailServerUserName ="hr" ''输入smtp服务器验证登陆名 (例如邮箱为:hr@hnihr.com)
msg.MailServerPassword ="123456" ''输入smtp服务器验证密码 (用户Email帐号对应的密码)
msg.From ="hr@hnihr.com"' ''发件人Email
msg.FromName ="易阳网络"' ''发件人姓名
msg.AddRecipient "317970602.com" ''收件人Email
msg.Subject ="信件主题"' ''信件主题
msg.Body ="称呼:"& request("name") &"<br>电话:"& request("tel") &"<br>标题:"& request("title") ''正文
msg.Send ("mail.hnihr.com") ''smtp服务器地址(例如邮箱为:*@163.com的smtp服务器地址为smtp.163.com)
set msg = nothing
response.Write("<script>alert('发送成功!');</script>")
end if
%>
谢谢啦,帮我解决了个大问题 。THANK YOU~
只有一个文件保存在哪里???
分享了!!!!!!!!谢谢