2013-01-14 85 views
0

基本上,我創建了一個包含To,From,Subject和Textbody的表單,所有命名都適當。我需要知道什麼代碼我需要使用經典ASP鏈接到本地​​端口,以測試我的代碼併發送電子郵件,使用電子郵件和本地服務器的經典ASP

我現在安裝了IIS和其他一些小程序,但我可以別把我的頭靠近了。

+0

我嘗試安裝「免費的SMTP服務器」和「本地SMTP服務器Pro例子'但說實話,我確定在ASP Code_中將它們鏈接到一個端口,或者如果我有IIS,可以用於鏈接到一個端口。謝謝你的回覆! –

回答

3

發送電子郵件通常是通過CDO進行中 - 使用Gmail的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") ="[email protected]" '#### 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 
+0

工作很好,謝謝HeavenCore! –

+0

@JackAllen沒問題,不要忘記勾選這個作爲答案:) – HeavenCore

+0

我需要15聲望來打勾!我確實嘗試過,只要我掙15生病回來哈哈 –

相關問題