📄 contact11.asp
字号:
<%@ Language=VBScript%>
<%
Response.Buffer=true
Response.Expires=0
%>
<!-- #include file="dsn_root.asp" -->
<!-- #include file="func.inc.asp" -->
<%
dim currentMenuId, cn, rs, sql
'指示当前活动的菜单项
currentMenuId = ""
set cn = Server.CreateObject("adodb.Connection")
set rs = Server.CreateObject("adodb.Recordset")
cn.Open mycnstr
code=Request.QueryString("code")
flag=Request.QueryString("flag")
if Request.ServerVariables("REQUEST_METHOD")="POST" then
if code = "" then
Response.Redirect "contact.asp?flag=0"
end if
title = fixedReplaceStr(Request.Form("title"), 60)
email = fixedReplaceStr(Request.Form("email"), 50)
myname = fixedReplaceStr(Request.Form("myname"), 10)
corpname = fixedReplaceStr(Request.Form("corpname"), 60)
address = fixedReplaceStr(Request.Form("address"), 60)
phone = fixedReplaceStr(Request.Form("phone"), 20)
fax = fixedReplaceStr(Request.Form("fax"), 20)
content = fixedReplaceStr(Request.Form("content"), "")
'检查是否选择了部门,并查找部门的邮箱地址
sql="select email from sys_dept where code='"+code+"'"
rs.Open sql,cn,0,1,1
if not rs.EOF then
sys_email=trim(rs("email"))
end if
rs.Close
'如果部门有邮箱地址,发送电子邮件
if sys_email <> "" then
txt="这个一封来自"+Request.ServerVariables("Http_HOST")+"的在线提交邮件!当您收到这封邮件后请不要直接回复,因为您只能直接回复到网站"
mailstr=txt+ chr(13) + chr(10)
mailstr=mailstr + "姓名:" + myname + chr(13) + chr(10)
mailstr=mailstr + "单位:" + corpname + chr(13) + chr(10)
mailstr=mailstr + "电话:" + phone + chr(13) + chr(10)
mailstr=mailstr + "地址:" + address + chr(13) + chr(10)
mailstr=mailstr + "传真:" + fax + chr(13) + chr(10)
mailstr=mailstr + "Email:" + email + chr(13) + chr(10)
mailstr=mailstr + "IP地址:" + Request.ServerVariables("Remote_HOST") + chr(13) + chr(10)
mailstr=mailstr + "内容:" + content + chr(13) + chr(10)
Set msg = Server.CreateObject("JMail.Message")
msg.silent = true
msg.Logging = true
msg.Charset = "gb2312"
msg.MailServerUserName = "public@ibw.com.cn" '输入smtp服务器验证登陆名
msg.MailServerPassword = "wangxin108" '输入smtp服务器验证密码 (用户Email帐号对应的密码)
if email="" then
msg.From ="public@ibw.com.cn"
else
msg.From = email
end if
msg.FromName = myname '发件人姓名
msg.AddRecipient sys_email '收件人Email
'msg.AddRecipientBCC "napoleon@ibw.com.cn" '密件传送'
msg.Subject = Request.ServerVariables("Http_HOST")+"网站留言"&now() '信件主题
msg.Body = "主题:"+title+chr(10)+chr(13)+mailstr '正文
msg.Send ("smtp.sina.net") 'smtp服务器地址(企业邮局地址)
set msg = nothing
end if
sql = "insert into contact (title,email,myname,corpname,address,phone,fax,content,flag,code,creadate, sysemail) values"_
& "('"&title&"','"&email&"','"&myname&"','"&corpname&"','"&address&"','"&phone&"','"&fax&"','"&content&"','0','"&code&"','"&now()&"', '"&sys_email&"')"
cn.Execute sql
set rs = nothing
cn.Close
set cn = nothing
Response.Redirect "contact.asp?code="&code&"&flag=1"
end if
if code="" then
sql="select code,deptname,address,phone,fax,email,website,linkman,zip from sys_dept order by sortnum"
else
sql="select code,deptname,address,phone,fax,email,website,linkman,zip from sys_dept where code='"+code+"' order by sortnum"
end if
rs.Open sql,cn,0,1,1
if not rs.EOF then
code=rs("code")
deptname=trim(rs("deptname"))
address=trim(rs("address"))
phone=trim(rs("phone"))
fax=trim(rs("fax"))
email=trim(rs("email"))
website=trim(rs("website"))
linkman=trim(rs("linkman"))
zip=trim(rs("zip"))
else
response.end
end if
rs.Close
%>
<!-- #include file="begin.asp" -->
<table width="1002" height="137" border="0" cellpadding="0" cellspacing="0" background="images/top_15.jpg">
<tr>
<td width="779"><img src="images/AA2.jpg" width="779" height="137"></td>
<td width="223"> </td>
</tr>
</table>
<table width="1002" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="162" align="center" valign="top" bgcolor="#F4F4F4">
<!-- #include file="inc_search.asp" //-->
<!-- #include file="inc_contact.asp" //-->
</td>
<td width="617" valign="top" background="images/index4_15.jpg"> <table width="617" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="13" height="31" background="images/index4_11.jpg"><img src="images/list2.jpg" width="5" height="31"></td>
<td width="604" valign="bottom" background="images/index4_11.jpg"> <table width="30%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="12%" height="17"><img src="images/list.gif" width="14" height="13"></td>
<td width="88%">联系我们</td>
</tr>
<tr>
<td height="4" colspan="2"> </td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2" align="center" valign="top"><table width="95%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="15"> </td>
</tr>
</table>
<table width="95%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="30" align="center"><img src="images/jt.gif" width="23" height="11"><strong>锋凯数码科技联系方式表</strong></td>
</tr>
<tr>
<td align="center">
<table width="500" height="23" border="0" cellpadding="1" cellspacing="1">
<tr align="center" bgcolor="#056112">
<%
sql = "select code,deptname from sys_dept order by sortnum"
rs.open sql,cn,0,1,1
do while not rs.EOF
%>
<td width="99"><a href="contact.asp?code=<%=rs("code")%>" class="A2"><%=trim(rs("deptname"))%></a></td>
<%
rs.MoveNext
loop
rs.Close
%>
</tr>
</table>
</td>
</tr>
<tr>
<td height="10" align="center"> </td>
</tr>
<tr>
<td align="center">
<table width="90%" border="0" cellpadding="1" cellspacing="1" bgcolor="#f5f5f5">
<tr>
<td bgcolor="#FFFFFF" style="padding-left:20px;">
- 公司电话:<%=phone%><br>
- 公司传真:<%=fax%><br>
- 联 系 人:<%=linkman%><br>
- 邮 编:<%=zip%>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="15" align="center"> </td>
</tr>
<tr>
<td height="30" align="center"><img src="images/jt.gif" width="23" height="11"><strong>在线发送电子邮件给<%=deptname%></strong></td>
</tr>
<tr>
<td height="1" align="center" bgcolor="#CCCCCC"> </td>
</tr>
<tr>
<td height="5" align="center" bgcolor="#f5f5f5"> </td>
</tr>
</table>
<table width="85%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td style="color:#FF0000;">
<%
if flag = "0" then
Response.Write "留言失败!"
elseif flag = "1" then
Response.Write "留言成功!"
end if
%>
</td>
</tr>
</table>
<table width="96%" border="0" cellspacing="0" cellpadding="0" align="CENTER" valign=top style="line-height:200%">
<form name="form1" method="post" action="contact.asp?code=<%=code%>" onsubmit="return check();">
<tr>
<td width="104" align=right>标题:</td>
<td width="555"> <input name="title" type="text" size=40 maxlength=60 style="border:1px solid #000000;"> <font color="#FF0000">*</font>
</td>
</tr>
<tr>
<td width="104" align=right>E-mail:</td>
<td width="555"> <input name="email" type="text" size=40 maxlength=50 style="border:1px solid #000000;"> <font color="#FF0000">*</font>
</td>
</tr>
<tr>
<td width="104" align=right>您的姓名:</td>
<td width="555"> <input name="myname" type="text" size=20 maxlength=10 style="border:1px solid #000000;"> <font color="#FF0000">*</font>
</td>
</tr>
<tr>
<td width="104" align=right>公司:</td>
<td width="555"> <input name="corpname" type="text" size=40 maxlength=60 style="border:1px solid #000000;">
</td>
</tr>
<tr>
<td width="104" align=right>地址:</td>
<td width="555"> <input name="address" type="text" size=40 maxlength=60 style="border:1px solid #000000;">
</td>
</tr>
<tr>
<td width="104" align=right>电话:</td>
<td width="555"> <input name="phone" type="text" size=40 maxlength=20 style="border:1px solid #000000;">
</td>
</tr>
<tr>
<td width="104" align=right>传真:</td>
<td width="555"> <input name="fax" type="text" size=30 maxlength=20 style="border:1px solid #000000;">
</td>
</tr>
<tr>
<td align=right width="104">内容:</td>
<td width="555"> <textarea name=content cols=50 rows=10 style="font-family:宋体" style="border:1px solid #000000;"></textarea>
</td>
</tr>
<tr height="40">
<td colspan="2" valign=middle style="padding-left:100px;"><input type="submit" value="发送"> <input type="reset" value="重填"></td>
</tr>
</form>
</table>
</td>
</tr>
</table>
</td>
<td width="223" valign="top" background="images/list.jpg">
<!-- #include file="inc_hot.asp" //-->
</td>
</tr>
</table>
<!-- #include file="end.asp" -->
<script language="javascript">
function check()
{
var obj = document.form1;
if (obj.title.value == "")
{
alert("请输入邮件标题!");
obj.title.focus();
return false;
}
if (obj.email.value == "")
{
alert("请输入你的邮件地址!");
obj.email.focus();
return false;
}
if (obj.myname.value == "")
{
alert("请输入您的姓名!");
obj.myname.focus();
return false;
}
if (obj.content.value == "")
{
alert("请输入您的留言内容!");
obj.content.focus();
return false;
}
return true;
}
</script>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -