简体   繁体   English

使用经典 ASP 发送邮件?

[英]Sending mail using classic ASP?

I am trying to send mail using classic ASP, but my page contain some error that's why when upload the page it shows the error that :我正在尝试使用经典 ASP 发送邮件,但我的页面包含一些错误,这就是为什么在上传页面时它显示以下错误:

500 Internal Server Error 500 内部服务器错误

This is the code i am using;这是我正在使用的代码;

<%
Dim smtpserver,youremail,yourpassword,ContactUs_Name,ContactUs_Tel,ContactUs_Email
Dim ContactUs_Subject,ContactUs_Body,Action,IsError

smtpserver = "smtp.gmail.com"
youremail = "xxxxx.yyyyyy@gmail.com"
yourpassword = "password" 

Dim ObjSendMail
Set ObjSendMail = CreateObject("CDO.Message") 
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 587 
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = 1 'Use SSL for the connection
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'basic (clear-text) authentication
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = "aaaaa.bbbbbb@gmail.com"
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "password"
ObjSendMail.Configuration.Fields.Update
ObjSendMail.To = "aaaaa.bbbbbb@gmail.com"
ObjSendMail.CC = "cccccc.dddddd@sunarctechnologies.com"
ObjSendMail.Subject = "Subject"
ObjSendMail.From = "xxxxx.yyyyyy@gmail.com"
ObjSendMail.HTMLBody = "<p>hello</p>"
ObjSendMail.Send
Set ObjSendMail = Nothing 
%>

I don't have any idea of classic asp this is just copy paste code from some other source.我对经典的 asp 一无所知,这只是从其他来源复制粘贴代码。

Your code looks correct but I'd check wheter gmail only accepts SSL connections on port 465. I believe port 567 is for TLS connections.您的代码看起来正确,但我会检查 gmail 是否只接受端口 465 上的 SSL 连接。我相信端口 567 用于 TLS 连接。 Alternatively just try port 25.或者,只需尝试端口 25。

This question is similar to yours . 这个问题和你的类似

You also really need to be able to see the detailed error messages your application is reporting.您还确实需要能够查看应用程序报告的详细错误消息。

Perhaps use the scripts here instead. 也许在这里使用脚本。 http://www.w3schools.com/asp/asp_send_email.asp . http://www.w3schools.com/asp/asp_send_email.asp This has worked for me. 这对我有用。

Assuming you have access to IIS, the first thing I recommend is to activate server side debugging and send errors to browser on in IIS.假设您可以访问 IIS,我建议的第一件事是激活服务器端调试并将错误发送到 IIS 中的浏览器。 An error 500 can mean anything form a missing end if to the object not being found.如果找不到对象,错误 500 可能意味着任何形式的缺失结束。 Having a proper error message to work with will help narrow down the source of the problem.使用正确的错误消息将有助于缩小问题的根源。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM