jmail
表单主要代码如下:
<form action="post.asp" method="post" name="mywebmail">
您的姓名:
<input type="text" name="name" size="20" maxlength="50">
电子邮件:
<input type="text" name="email" size="20" maxlength="60">
邮件主题:
<input type="text" name="mailsubject" size="30" maxlength="100">
您的意见和建议:<br>
<textarea rows="4" name="text" cols="40"></textarea>
<input type="submit" value="确认递交" name="submit">
<input type="reset" value="清除重写" name="clear">
</form>
post.asp代码:
<html>
<head>
<title>发送表单</title>
<body>
<html>
<head>
<title>发送表单</title>
<body>
<%
'首先使用Request方法取得表单数据,取得的数据放在等号左侧的变量中;
name = Request.Form ("name")
email= Request.Form ("email")
mailsubject= Request.Form ("mailsubject")
text = Request.Form ("text")
%>
<%
‘创建jmail对象;
Set JMail = Server.CreateObject("JMail.SMTPMail")
' 邮件服务器名称
JMail.ServerAddress = "mail.263.net.cn:25"
' 发件人的信箱
JMail.Sender = email
' 邮件标题
JMail.Subject = mailsubject
' 设置邮件的收件人信箱;
JMail.AddRecipient "xxxx@mailhost.com"
'下面就是填表在内容区填写的内容,&是连接符,vbcrlf表示换行回车。
mess = "---------------Webmail表单开始-------------------" & vbcrlf
mess = mess & "留言人姓名:" & name & vbcrlf
mess = mess & "留言人邮件:" & email & vbcrlf
mess = mess & "留言人留言:" & text & vbcrlf
mess = mess & "---------------Webmail表单结束-------------------"
JMail.Body = mess
'设置邮件的优先级(1-5,1为最高)
JMail.Priority = 1
'执行发送任务;
JMail.Execute
%>
<center>
邮件已顺利发出!
</center>
</body>
</html>