在ASP中用EasyMailObject組件處理Exchange郵件原始碼(5)

來源:互聯網
上載者:User
object|原始碼 發送郵件(p_sendmail.asp)
<%@ 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();">
<font face="宋體" size="5"><b><span style="background-color: #FFFF00">返回</span></b></font></a></P>

</BODY>
</HTML>



相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.