经典的asp发送邮件

时间:2012-07-10 20:01:58

标签: asp-classic jmail

我使用此代码使用经典ASP发送电子邮件:

Set oJMail = Server.CreateObject("JMail.SMTPMail")
with oJMail
    .Sender = "myemail"
    .SenderName = "Me"
    .AddRecipient "some email"
    .Subject = "some subject"
    .Body = "Name: " & fname & " Email:" & email & "Phone: " & phone
end with

oJMail.ServerAddress = "mysmtp:25"
oJMail.Execute
Set oJMail = Nothing

但是服务器不断抛出这个错误:

Microsoft JScript compilation error '800a03ec'

Expected ';'

/index.asp, line 108

Set oJMail = Server.CreateObject("JMail.SMTPMail")
----^

这可以与我的页面标题有关吗?

<%@ Language="javascript" %>

1 个答案:

答案 0 :(得分:2)

是的,这看起来像VBScript代码,在这种情况下,您希望页面标题包含:

<%@ Language="VBScript" %> 

当然,如果页面的其余部分已经用JavaScript编写,则会导致问题。