简体   繁体   English

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

[英]Classic ASP using Email and Local Server

Basically, I have created a form with a To, From, Subject and Textbody, all named appropriately. 基本上,我已经创建了一个带有To,From,Subject和Textbody的表单,它们都被适当地命名。 What I need to know is what code I need to use Classic ASP to link to a local port, to test my code and send an email, 我需要知道的是使用Classic ASP链接到本地​​端口,测试我的代码并发送电子邮件所需的代码,

I have IIS installed at the moment and some other little programs, but I can't get my head around it. 目前,我已经安装了IIS和其他一些小程序,但是我无法理解。

Sending an email in is usually done in via CDO - example using gmails SMTP server (note the use of configuration/smtpserverport and configuration/smtpusessl ) 发送电子邮件通常是通过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 

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

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