打印本文 打印本文  关闭窗口 关闭窗口  
利用WinWebMail组件在ASP页面中直接发送纯文本或是html格式的电子邮件
作者:WinWebMail  文章来源:WinWebMail  点击数  更新时间:2006/5/6 11:33:23  文章录入:admin  责任编辑:admin

在安装了WinWebMail之后,您将可以利用WinWebMail组件在ASP页面中直接发送纯文本或是html格式的电子邮件(无需登录)。

版本要求3.7.0.1版或更高版本

  此ASP文件必须被放置于WebMail的虚拟目录之下时才可以调用成功,如果您需要在其他网站上使用此组件对外发信时,建议使用Post方式将数据传递到当前页面,再经由此页面发送出去。
  绿色部分是可变内容。
  深蓝色部分是为了防止系统Session超时可能引起发送失败而加入的内容。

下载 ASPsend文件包(1K)

<%@LANGUAGE = VBSCRIPT%>
<html>
<body>

<%
if IsEmpty(Application("em_MaxMPOP3")) and IsEmpty(Application("em_MaxSigns")) then
    dim mam
    set mam = server.createobject("easymail.AdminManager")

    tmp_num = 0
    do while tmp_num < 30
        mam.LoadExt

        if mam.IsLoadOK = true then
            Exit Do
        end if

        mam.Sleep 500
        tmp_num = tmp_num + 1
    loop

    if mam.IsLoadOK = true then
        Application("em_MaxMPOP3") = mam.MaxMPOP3
        Application("em_MaxSigns") = mam.MaxSigns
        Application("em_SystemAdmin") = LCase(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") = LCase(mam.TestAccounts)
        Application("em_SignMode") = mam.SignMode
        Application("em_SignWaitDays") = mam.SignWaitDays
        Application("em_am_Name") = mam.am_Name
        Application("em_am_Accounts") = LCase(mam.am_Accounts)
        Application("em_AccountsAdmin") = LCase(mam.AccountsAdmin)

        Application("em_EnableTrap") = mam.EnableTrap
        if mam.EnableTrap = true then
            Application("em_TrapMail") = mam.TrapMail
        end if
    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@cidu.net"

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>
打印本文 打印本文  关闭窗口 关闭窗口