欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

用EasyMailObject组件处理Exchange邮件源代码(5)

程序员文章站 2023-10-28 19:57:10
在asp中用easymailobject处理exchange邮件源代码---发送邮件(p_sendmail.)<%@ language=vbscript %><%*********...
在asp中用easymailobject处理exchange邮件源代码---发送邮件(p_sendmail.)

<%@ language=vbscript %>
<%
*************************************

这个文件用来发送邮件
作者:awayeah
邮箱:awayeah@163.net

*************************************

if session("straccount")="" or session("strpassword")="" then
response.end
end if
%>
<html>
<head>
<meta name="generator" content="microsoft visual studio 6.0">
</head>
<style>
<!--
a{text-decoration:none}
-->
</style>
<body>
<%   set smtp = createobject("easymail.smtp.5")
   smtp.licensekey = "awa/s19i500r1ax30c0r3100"
   smtp.mailserver = "192.9.200.89"
   smtp.subject = request.form("subject")
   smtp.bodytext = request.form("bodytext")
   smtp.from = request.form("from")
   smtp.fromaddr = request.form("fromaddr")
   smtp.addrecipient request.form("from"), request.form("receive1") , 1
   
   添加附件
   if request.form("att")="" then
   response.write ""
   else
   x = smtp.addattachment(request.form("att"), 0)
   if not x = 0 then
     response.write "插入附件错误: " + cstr(x) + "请与管理员联系。"
   end if
   end if
   x = smtp.send

   if x = 0 then
      response.write ("<p align=center><br><br>")
     response.write ("<font size=")
      response.write "<p align=center><br><br><b><font face=宋体 size=5 color=#00ffff><span style=background-color: #000080>邮件已成功发出!</font></span></b>"
      session("sended")="y"
   else
  if x=7 or x=5 then
      response.write "<br><br><p align=center><b><font face=宋体 size=5 color=#00ffff><span style=background-color: #000080>发邮件发生错误(" + cstr(x)+ ").发件人地址错误</span></font></b>"%>
       <br><br><input type="button" onclick="history.go(-1)"  value="返回">
      <%response.end
  else
      response.write "<br><br><p align=center><b><font face=宋体 size=5 color=#00ffff><span style=background-color: #000080>发邮件发生错误: "   + cstr(x)+ "</span></font></b>"%>
       <br><br><input type="button" onclick="history.go(-1)"  value="返回" id=button1 name=button1>
      <%response.end
  end if
  end if


   set smtp = nothing
   
%>

<p align="center"> <a href="javascript:window.close();">