| ASP 上配合 CDO.Message 物件使用 SMTP 驗證發信, 請參考下列程式範例: 使用 CDO.Message 為共通元件,不需特別安裝其它發信元件,在平台移植上有非常便利的好處。 <% Set objMail = CreateObject("CDO.Message")objMail.Subject      = "Mail Subject"               '發信主題
 objMail.From         = "frommail@yourdomain.com"    '發信者電子信箱
 objMail.To           = "tomail@yourdomain.com"      '收件者電子信箱
 objMail.TextBody     = "Test message."              '信件內容
 
 objMail.Configuration.Fields.Item _
 ("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
 'SMTP 伺服器位址
 objMail.Configuration.Fields.Item _
 ("http://schemas.microsoft.com/cdo/configuration/smtpserver")="xxx.yourdomain.com"
 'SMTP 伺服器連線 Port
 objMail.Configuration.Fields.Item _
 ("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25
 '是否使用 SSL 連線 (False or True)
 objMail.Configuration.Fields.Item _
 ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
 '連線伺服器逾時時間
 objMail.Configuration.Fields.Item _
 ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 30
 'SMTP 伺服器是否需要驗證
 objMail.Configuration.Fields.Item _
 ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
 'SMTP 伺服器使用者名稱
 objMail.Configuration.Fields.Item _
 ("http://schemas.microsoft.com/cdo/configuration/sendusername") = "user@yourdomain.com"
 'SMTP 伺服器使用者密碼
 objMail.Configuration.Fields.Item _
 ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "********"
 
 objMail.Configuration.Fields.Update
 
 objMail.Send
 set objMail=nothing
 %>  |