JMail 組件
Dimac 公司的(de)郵件收發組件,這(zhè)是(shì)一個(gè)非常成熟和(hé / huò)強大(dà)的(de)郵件組件。它不(bù)但可以(yǐ)完成發郵件的(de)工作,還可以(yǐ)POP收信,并支持收發郵件時(shí)的(de)PGP加密,内置一個(gè)群發郵件的(de)對象,可以(yǐ)使群發編程更簡單。
即使是(shì)很多其他(tā)組件也(yě)都能完成的(de)發郵件功能,JMail 的(de)完成也(yě)可以(yǐ)稱得上(shàng)最出(chū)色的(de),除了(le/liǎo)常見的(de)抄送暗送等多收件人(rén)功能外,它還支持添加嵌入式圖片附件,并且可以(yǐ)從URL讀取文件作爲(wéi / wèi)附件。
JMail 的(de)免費版本擁有全部完成的(de)發郵件功能,隻在(zài)收郵件和(hé / huò)加密郵件等我們不(bù)常用到(dào)的(de)方面進行了(le/liǎo)限制。
免費版下載 | V4中文手冊下載(PDF) | Smtpmail對象中文參考下載(PDF) | 官方網站 www.dimac.net
(注意,PDF電子(zǐ)文檔,使用Adobe Acrobat Reader閱讀。)
以(yǐ)下是(shì)在(zài)asp程序中調用jmail組件在(zài)線發送郵件的(de)例子(zǐ):
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<%if request("action")="send" then%>
<%
'參數說(shuō)明
'Subject : 郵件标題
'MailAddress : 發件服務器的(de)地(dì / de)址,如smtp.163.com
'Email : 收件人(rén)郵件地(dì / de)址
'Sender : 發件人(rén)姓名
'Content : 郵件内容
'Fromer : 發件人(rén)的(de)郵件地(dì / de)址
Sub SendAction(subject, email, sender, content)
Set JMail = Server.CreateObject("JMail.Message")
JMail.Charset = "gb2312" ' 郵件字符集,默認爲(wéi / wèi)"US-ASCII"
JMail.From = strMailUser ' 發送者地(dì / de)址
JMail.FromName = sender' 發送者姓名
JMail.Subject =subject
JMail.MailServerUserName = strMailUser' 身份驗證的(de)用戶名
JMail.MailServerPassword = strMailPass ' 身份驗證的(de)密碼
JMail.Priority = 3
JMail.AddRecipient(email)
JMail.Body = content
JMail.Send(strMailAddress)
End Sub
'調用此Sub的(de)例子(zǐ)
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" '這(zhè)是(shì)收信的(de)地(dì / de)址,可以(yǐ)改爲(wéi / wèi)其它的(de)郵箱
strMailAddress = "mail.yourdomain.com" '我司企業郵局地(dì / de)址,請使用 mail.您的(de)域名
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">你的(de)郵箱(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%>
詳情請下載演示文檔:
http://www.myhostadmin.net/formjmail.rar