Jmail 发送邮件的例子1

Mr.zhuMr.zhu2025-08-16 00:30:17来源:有趣的开源 (hellogithub.com)阅读:28

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">


<%if request("action")="send" then%>
<%

'参数说明
'Subject : 邮件标题
'MailAddress : 发件服务器的地址,如smtp.163.com
'Email : 收件人邮件地址
'Sender : 发件人姓名
'Content : 邮件内容
'Fromer : 发件人的邮件地址

Sub SendAction(subject, email, sender, content)
 Set JMail = Server.CreateObject("JMail.Message")
 JMail.Charset = "gb2312" ' 邮件字符集,默认为"US-ASCII"
 JMail.From = strMailUser ' 发送者地址
 JMail.FromName = sender' 发送者姓名
 JMail.Subject =subject
 JMail.MailServerUserName = strMailUser' 身份验证的用户名
 JMail.MailServerPassword = strMailPass ' 身份验证的密码
 JMail.Priority = 3
 JMail.AddRecipient(email)
 JMail.Body = content
 JMail.Send(strMailAddress)
End Sub

'调用此Sub的例子
Dim strSubject,strEmail,strMailAdress,strSender,strContent,strFromer
strSubject = Request("title")
strContent = "用户Email:" & Request("From") & VbCrLf & "电话:" & Request("Tel") & VbCrLf & "内容:" & vbcrlf & Request("content")
strSender  = Request("Name")
strEmail = "anybody@163.com" '这是收信的地址,可以改为其它的邮箱
strMailAddress = "mail.yourdomain.com" '我司企业邮局地址,请使用 mail.您的域名
strMailUser  = "user@yourdomain.com" '我司企业邮局用户名
strMailPass  = "mailpassword" '邮局用户密码

Call SendAction (strSubject,strEmail,strSender,strContent)

%>

<script language="javascript">
alert('恭喜您,发送成功!');
history.back();
</script>


<%else%>
<style type="text/css">
<!--body { margin-top: 0px;margin-bottom: 0px;}td {
 font-size: 12px;
 text-decoration: none;}--></style>
<table width="500" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#666666">
<tr><td height="40" bgcolor="#E3E3E3"><div align="center">发邮件给我们</div></td></tr>
<tr><td background="images/formmail_r2_c1.gif"><table width="100%" height="296" border="0" align="center" cellpadding="1" cellspacing="1">
<form name="form" method="post" action="?action=send">
<tr bgcolor="#FFFFFF">
<td width="110" align="center"><div align="left">邮件主题(title)*</div></td>
<td width="288"><input name="title" type="text" id="title" size="22">
姓名(name)
<input name="name" type="text" id="name" size="8">
</td>
</tr>
<tr bgcolor="#FFFFFF">
<td align="center"><div align="left">你的邮箱(mailaddress)*</div></td>
<td><input name="from" type="text" id="from" size="22">
电话(tel)
<input name="tel" type="text" id="tel" size="15"></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="213" align="center"><div align="left">内容(content):*<br>
</div></td>
<td><textarea name="content" cols="50" rows="15"></textarea></td>
</tr>
<tr bgcolor="#FFFFFF">
<td> </td>
<td> <input type="submit" name="Submit" value="提交"></td></tr></form></table></td>
</tr></table>
<%end if%>

猜你想看

研究:已知最近黑洞距地球1600光年
新手零基础跑步,应该跑多久?跑多快?
几千面霜和一次热玛吉,哪一个更划算?
怎么选择汽车雪地胎?有哪些技巧
油表灯亮了还能开多远?油量还剩多少的时候去加油最合适?
减肥吗?来看看这份路边摊热量图鉴
车子一年才跑了两千公里,有必要换机油吗?
做焖面不要直接下锅焖,多加这一步,面条劲道又入味,一碗不够吃
“阳了”看病吃药医保咋报销?多地已明确→
低首付购车有什么好处?低首付买新车和全款买车相比怎么样?
什么是模态分析?模态分析有什么用?
培根肉是什么肉?为啥叫培根?许多人不知道,还经常吃
办理退休时,遇到这些问题“别慌”,抓紧看,也许会帮到你
夏天炒绿豆芽、一定要加点它,中和寒性不伤胃,吃的时候才放心
《完蛋!我被美女包围了》登顶Steam热销榜,真人互动游戏的风口能否持久?
400w、800w、1200w的电动车有什么区别?又该怎么选?今天告诉你
劳动仲裁调解后不给钱怎么办呢
自动挡汽车应用驾驶操作练习-启动发动机(点火)操作规范
为什么腕表机芯里面的钻,要用红宝石
女人单身久了,是可以看出来的,某些特征会很不一样

推荐站点