我使用以下代码发送电子邮件。问题是它向所有域发送电子邮件,如gmail,live,yahoo等。它正确地发送电子邮件,但是当我将它发送到我的域时,它会向我显示错误。
The page cannot be displayed because an internal server error has occurred.
set omail = Server.CreateObject("CDO.Message")
Set objConfig = Server.CreateObject("CDO.Configuration")
Set Confi = objConfig.Fields
confi("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost"
Confi("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
confi("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
Confi.Update
Set omail.Configuration = objConfig
'omail.To = "ABC@gmail.com"
omail.To = "ABC@ABCXYZ.com"
omail.From = Test@gmail.com"
omail.subject = "From : Test"
omail.TextBody = vBody
omail.Send
我找不到问题。
答案 0 :(得分:1)
在问题中添加语法突出显示问题;
omail.From = Test@gmail.com"
应该是
omail.From = "Test@gmail.com"
您缺少双引号("
)来启动字符串,这将导致VBScript中的语法错误,从而从IIS生成HTTP 500 Internal Server Error
。