0
我從w3school抓取了這個示例,但是當我添加if語句來檢查電子郵件是否已發送時,即使我收到電子郵件,也會顯示錯誤代碼。CDO - 即使發送電子郵件,發送電子郵件也會返回false
我不知道asp如何工作,但我假設myMail返回一個布爾值?或者不是?如何檢查電子郵件是否已發送。
<%
Set myMail=CreateObject("CDO.Message")
myMail.Subject="Sending email with CDO"
myMail.From="[email protected]"
myMail.To="[email protected]"
myMail.HTMLBody = "<h1>This is a message.</h1>"
If myMail.Send Then
Response.AddHeader "Content-type", "application/json"
Response.Write "{ request: 'success'}"
Else
Response.AddHeader "Content-type", "application/json"
Response.Write "{ request: 'failed'}"
End If
set myMail=nothing
%>
+1,但也請您正確使用不當'AddHeader'的使用'ContentType'屬性。 – AnthonyWJones 2012-02-17 08:46:15
@AnthonyWJones Doh,當然,剛剛複製了OP代碼並粘貼了! – 2012-02-17 09:25:06