使用电子邮件和本地服务器的经典ASP

时间:2013-01-14 11:11:45

标签: email iis-7 asp-classic localhost

基本上,我创建了一个包含To,From,Subject和Textbody的表单,所有表单都适当命名。我需要知道的是使用Classic ASP链接到本地​​端口,测试我的代码和发送电子邮件所需的代码,

我目前安装了IIS以及其他一些小程序,但我无法理解它。

1 个答案:

答案 0 :(得分:3)

中发送电子邮件通常是通过CDO进行的 - 例如使用gmails SMTP服务器(请注意使用configuration/smtpserverportconfiguration/smtpusessl

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") = 465
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = 1
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60

ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") ="info@thedomain.com" '#### Gmail Username (usually full email address)
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") ="password" '#### Gmail Password

ObjSendMail.Configuration.Fields.Update

ObjSendMail.To = ""
ObjSendMail.Subject = ""
ObjSendMail.From = ""

ObjSendMail.TextBody = "Hello World"

ObjSendMail.Send
Set ObjSendMail = Nothing