日期:2014-05-17  浏览次数:20895 次

留言板内容点提交后提交到邮箱
留言板内容点提交后提交到邮箱,空间不支持jmail。不要通过outlook

试用如下代码.asp文件
C# code
<% 
Const cdoSendUsingMethod="http://schemas.microsoft.com/cdo/configuration/sendusing" 
Const cdoSendUsingPort=2 
Const cdoSMTPServer="http://schemas.microsoft.com/cdo/configuration/smtpserver" 
Const cdoSMTPServerPort="http://schemas.microsoft.com/cdo/configuration/smtpserverport" 
Const cdoSMTPConnectionTimeout="http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout" 
Const cdoSMTPAuthenticate="http://schemas.microsoft.com/cdo/configuration/smtpauthenticate" 
Const cdoBasic=1 
Const cdoSendUserName="http://schemas.microsoft.com/cdo/configuration/sendusername" 
Const cdoSendPassword="http://schemas.microsoft.com/cdo/configuration/sendpassword" 

Dim objConfig ' As CDO.Configuration 
Dim objMessage ' As CDO.Message 
Dim Fields ' As ADODB.Fields 

Set objConfig = Server.CreateObject("CDO.Configuration") 
Set Fields = objConfig.Fields 

With Fields 
.Item(cdoSendUsingMethod) = cdoSendUsingPort 
.Item(cdoSMTPServer) = "smtp.gmail.com" '改成可用的外部邮件服务器域名 
.Item(cdoSMTPServerPort) = 25 
.Item(cdoSMTPConnectionTimeout) = 10 
.Item(cdoSMTPAuthenticate) = cdoBasic 
.Item(cdoSendUserName) = "ljt6444" '以上服务器的用户名 
.Item(cdoSendPassword) = "******" '密码 
.Update 
End With 

Set objMessage = Server.CreateObject("CDO.Message") 
Set objMessage.Configuration = objConfig 

With objMessage 
.To = Trim(Request.Form("ljt6444@gmail.com")) '改成接收者的邮件地址 
.From = "563440444@qq.com" '改成发送人的邮件地址 
.Subject = Trim(Request.Form("m_zhuzi")) '标题 
.TextBody = Trim(Request.Form("m_neirong")) '正文 
.Send 
End With 

Set Fields = Nothing 
Set objMessage = Nothing 
Set objConfig = Nothing 
%> 



外加html代码
C# code
<div style=" width:400px; height:400px; margin:auto; padding-top:80px;">
  <form id="frm" name="frm" method="post" action="mail.asp" onsubmit="return verify()" enctype="text/plain">

    <div style="width:200px; height:30px; float:left; text-align:center; padding-top:10px;">标题:</div>
    <div style="width:200px; height:30px; float:left; text-align:center;padding-top:10px;">
      <input name="m_zhuzi" type="text" />
    </div>
    <div style="width:200px; height:30px; float:left; text-align:center; padding-top:10px;">您的姓名:</div>
    <div style="width:200px; height:30px; float:left; text-align:center;padding-top:10px;">
      <input name="GBook_Name" type="text" />
    </div>
    <div style="width:200px; height:80px; float:left; text-align:center; padding-top:10px;">留言内容:</div>
    <div style="width:200px; height:80px; float:left; text-align:center;padding-top:10px;">
      <textarea name="m_neirong" rows="5" style="width:170px;"></textarea>
    </div>
    <div style=" width:400px; height:40px; text-align:center; padding-top:40px;"> 验证码
      <input name="yzm" type="text" id="yzm" size="7" value="点击获取" maxlength="6" onfocus="yzmview();this.value=''" />
      &nbsp;
      <input name="txt" type="text" id="txt" size="5" readonly="readonly" style="color:#C00;font-weight:bold;border:0px" />
    </div>
    <div style="width:390px; height:20px; text-