ASP发送邮件的实现(用WEBEASYMAIL)???

theninthstar 2004-04-11 11:08:37
我的网站空间支持webeasymail发送邮件,但是我没有用过这个组件,有没有谁会啊,希望指点一二噢!!
...全文
45 点赞 收藏 6
写回复
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
2599 2004-04-13
<%@LANGUAGE = VBSCRIPT%>
<html>
<body>

<%
if IsEmpty(Application("em_MaxFolders")) and IsEmpty(Application("em_MaxMPOP3")) and IsEmpty(Application("em_MaxSigns")) then
TimeDelaySeconds(5)

dim mam
set mam = server.createobject("easymail.AdminManager")
mam.Load

if mam.IsLoadOK = true then
Application("em_MaxFolders") = mam.MaxFolders
Application("em_MaxMPOP3") = mam.MaxMPOP3
Application("em_MaxSigns") = mam.MaxSigns
Application("em_SystemAdmin") = mam.SystemAdmin
Application("em_EnableBBS") = mam.EnableBBS
Application("em_Enable_SignHold") = mam.Enable_SignHold
Application("em_Enable_FreeSign") = mam.Enable_FreeSign
Application("em_Enable_SignWithDomainUser") = mam.Enable_SignWithDomainUser
Application("em_Enable_SignNumberLimit") = mam.Enable_SignNumberLimit
Application("em_SignNumberLimitDays") = mam.SignNumberLimitDays
Application("em_Enable_ShareFolder") = mam.Enable_ShareFolder
Application("em_Enable_SignEnglishName") = mam.Enable_SignEnglishName
Application("em_LogPageKSize") = mam.LogPageKSize
Application("em_TestAccounts") = mam.TestAccounts
Application("em_SignMode") = mam.SignMode
Application("em_SignWaitDays") = mam.SignWaitDays
Application("em_am_Name") = mam.am_Name
Application("em_am_Accounts") = mam.am_Accounts
end if

set mam = nothing
end if
%>

<%
Dim mailsend
Dim sender


' 发送帐号是 admin
sender = "admin"


' 创建MailSend对象
Set mailsend = Server.CreateObject("easymail.MailSend")

mailsend.CreateNew sender, "temp"


' 发信人名称
mailsend.MailName = "系统管理员"

' 收件人邮件地址
mailsend.EM_To = "admin@system.mail"

mailsend.EM_Subject = "邮件主题"
mailsend.EM_Text = "邮件正文内容!"


' ================== 需要发送html格式邮件时使用以下内容 ==================
' 输入html邮件内容
'mailsend.EM_HTML_Text = "<html>请在此处输入html邮件内容...</html>"
'mailsend.useRichEditer = true
' ========================================================================


if mailsend.Send() = false then
Response.Write "邮件发送失败!"
else
Response.Write "邮件发送成功!"
end if


Set mailsend = Nothing
%>

</body>
</html>


<%
function TimeDelaySeconds(DelaySeconds)
SecCount = 0
Sec2 = 0
while SecCount < DelaySeconds + 1
Sec1 = Second(Time())
if Sec1 <> Sec2 then
Sec2 = Second(Time())
SecCount = SecCount + 1
end if
wend
end function
%>
回复
jiank 2004-04-13
<%@LANGUAGE = VBSCRIPT%>
<html>
<body>

<%
if IsEmpty(Application("em_MaxFolders")) and IsEmpty(Application("em_MaxMPOP3")) and IsEmpty(Application("em_MaxSigns")) then
TimeDelaySeconds(5)

dim mam
set mam = server.createobject("easymail.AdminManager")
mam.Load

if mam.IsLoadOK = true then
Application("em_MaxFolders") = mam.MaxFolders
Application("em_MaxMPOP3") = mam.MaxMPOP3
Application("em_MaxSigns") = mam.MaxSigns
Application("em_SystemAdmin") = mam.SystemAdmin
Application("em_EnableBBS") = mam.EnableBBS
Application("em_Enable_SignHold") = mam.Enable_SignHold
Application("em_Enable_FreeSign") = mam.Enable_FreeSign
Application("em_Enable_SignWithDomainUser") = mam.Enable_SignWithDomainUser
Application("em_Enable_SignNumberLimit") = mam.Enable_SignNumberLimit
Application("em_SignNumberLimitDays") = mam.SignNumberLimitDays
Application("em_Enable_ShareFolder") = mam.Enable_ShareFolder
Application("em_Enable_SignEnglishName") = mam.Enable_SignEnglishName
Application("em_LogPageKSize") = mam.LogPageKSize
Application("em_TestAccounts") = mam.TestAccounts
Application("em_SignMode") = mam.SignMode
Application("em_SignWaitDays") = mam.SignWaitDays
Application("em_am_Name") = mam.am_Name
Application("em_am_Accounts") = mam.am_Accounts
end if

set mam = nothing
end if
%>

<%
Dim mailsend
Dim sender


' 发送帐号是 admin
sender = "admin"


' 创建MailSend对象
Set mailsend = Server.CreateObject("easymail.MailSend")

mailsend.CreateNew sender, "temp"


' 发信人名称
mailsend.MailName = "系统管理员"

' 收件人邮件地址
mailsend.EM_To = "admin@system.mail"

mailsend.EM_Subject = "邮件主题"
mailsend.EM_Text = "邮件正文内容!"


' ================== 需要发送html格式邮件时使用以下内容 ==================
' 输入html邮件内容
'mailsend.EM_HTML_Text = "<html>请在此处输入html邮件内容...</html>"
'mailsend.useRichEditer = true
' ========================================================================


if mailsend.Send() = false then
Response.Write "邮件发送失败!"
else
Response.Write "邮件发送成功!"
end if


Set mailsend = Nothing
%>

</body>
</html>


<%
function TimeDelaySeconds(DelaySeconds)
SecCount = 0
Sec2 = 0
while SecCount < DelaySeconds + 1
Sec1 = Second(Time())
if Sec1 <> Sec2 then
Sec2 = Second(Time())
SecCount = SecCount + 1
end if
wend
end function
%>
这是WEBEASYMAIL的组件发送说明,简单。
回复
bjbr 2004-04-13
三楼似乎只可发送到本服务器的邮箱
回复
threezxw 2004-04-13
我也没用国
回复
ydh1981 2004-04-13
<%
'*********************************************************************************
'****
'**** 邮件发送系统 2003-05-
'****
'*********************************************************************************
'/////////////////////////////////////////////////////////////////////////////////
'参数说明
'strFrom : 发件人Email
'strTo : 收件人Email
'strSubject : 信件主题
'strBody : 信件正文
'lngImportance : 信件重要性
' : 0 - 低重要性
' : 1 - 中等重要性(默认)
' : 2 - 高重要性
'lngAType : 信件格式
' : 为1时将邮件正文作为HTML(此时可以发送HTML邮件)
'strAttach : 附件的路径
'附件(注意 strAttach 指的是服务器上的位置,如果使用相对路径,必须用 Server.MapPath 映射为真实路径)

'发送普通邮件
'SendMail "zgny@zgny.com.cn", "lihuoming@163.net", "This mail Title!", "This mail content!", 2, 0, "C:\Love.txt"
'发送HTML邮件
'Set m_fso = Server.CreateObject("SCRIPTING.FILESYSTEMOBJECT")
'Set m_tf = m_fso.OpenTextFile("C:\Mail.htm", 1)
'm_strHTML = m_tf.ReadAll
'Set m_tf = Nothing
'Set m_fso = Nothing
'SendMail "zgny@zgny.com.cn", "lihuoming@163.net", "This Html_mail Title!", m_strHTML, 2, 1, Null
'/////////////////////////////////////////////////////////////////////////////////

Sub SendMail(strFrom, strTo, strSubject, strBody, lngImportance, lngAType, strAttach)
Dim objMail

Set objMail = Server.CreateObject("CDONTS.NEWMAIL")
With objMail

.From = strFrom '发件人
.To = strTo '收件人
'密件抄送
'.Bcc = "lihuoming@sina.com"

'抄送
'.Cc = "lihuoming@sina.com"

.Subject = strSubject
.Body = strBody
' Importance 邮件的重要性
' 0 重要性低
' 1 重要性一般(默认)
' 2 重要性高
.Importance = lngImportance

If lngAType = 1 Then
'0 表示该 Body 可包含超文本置标语言 (HTML)
'1 表示该 Body 只用于纯文本(默认值)
.BodyFormat = 0
.MailFormat = 0
End If

If IsEmpty(strAttach) = False And IsNull(strAttach) = False Then
.AttachFile strAttach
End If

.Send
End With
Set objMail = Nothing
End Sub
%>


调用这个过程,就可,选择发文件的参数,让程序自动发邮件,用SMTP就可以,根本不需要webeasymail,它是邮件服务器.但程序用的只是发送邮件的组件.



回复
jhlgxyxl 2004-04-13
下面是一个注册成功时的送邮件的过程:
希望对你有帮助。

Dim mailsend
Dim sender
str="尊敬的"&username&":"
str=str&"<p>"
str=str&"    恭喜您注册成功。"
str=str&"<br>"
str=str&"    您已成为会员。"
str=str&"<br>"
str=str&"    您登陆密码为:"&password&",请务必记住此登陆码,<br>因为您必须以此登陆码才能登陆本站。"
str=str&"<br>"
str=str&"    如果您注册的是高级会员,请等待验证和通知。"
str=str&"<br>"
str=str&"    希望能给您带来新的收获,顺祝收成日丰!"
str=str&"<br>"
str=str&"<hr>"
str=str&"<br>"
str=str&"    Jhalei在线"
str=str& "    E-mail:jhlgxyxl@sohu.com"

Set mailsend = Server.CreateObject("easymail.MailSend")
mailsend.CreateNew "jhlgxyxl@sohu.com","Welcome"
' 发信人名称
mailsend.MailName = "Jhalei在线"
mailsend.EM_To =email
'收件人邮件地址
mailsend.EM_Subject = "注册成功!!" '邮件主题"
mailsend.EM_HTML_Text =str
mailsend.useRichEditer = true
mailsend.send
set mailsend=nothing
回复
发动态
发帖子
ASP
创建于2007-09-28

2.8w+

社区成员

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
申请成为版主
社区公告
暂无公告