我从数据库中收集邮件地址,并使用旧的Classic ASP发送邮件。JMail需要在应用程序池中禁用32位模式。
Set sender = Server.CreateOBject("JMail.Message")
最近我添加了Oracle DB来收集更多的邮件地址,并注意到下面的代码需要启用32位模式的应用程序池:
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "Provider=OraOLEDB.Oracle;Data Source=(DESCRIPTION=(CID=GTU_APP)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.35.200)(PORT=1521)))(CONNECT_DATA=(SID=MYDB)(SERVER=DEDICATED)));User Id=MYNAME;Password=MyPass;"
这看起来像是一个奇怪的困境。在我的情况下,什么是变通/解决方案?
我将更改为没有冲突需求的ASP Email组件。就我个人而言,我使用的是ASPEmail。这是一个谷歌:)。
我学得很好& &;几年后使用了CDO。下面是我的代码:
<%
Const cdoSendUsingPickup = 1 'Send message using the local SMTP service pickup directory.
Const cdoSendUsingPort = 2 'Send the message using the network (SMTP over the network).
Const cdoAnonymous = 0 'Do not authenticate
Const cdoBasic = 1 'basic (clear-text) authentication
Const cdoNTLM = 2 'NTLM
dim objEmail
Set objEmail = CreateObject("CDO.Message")
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing")= cdoSendUsingPort
'Name or IP of remote SMTP server
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="mail.domain.com"
'Server port
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpAuthenticate") = cdoBasic
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = "info@domain.com"
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "thepassword"
objEmail.BodyPart.Charset = "Windows-1254"
'objEmail.TextBodyPart.Charset = "utf-8"
'objEmail.HTMLBodyPart.Charset = "utf-8"
'objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/SaveSentItems") = TRUE
objEmail.Configuration.Fields.Update
objEmail.From = "My Name <myname@domain.com>"
objEmail.To = "The Name <name@targetmail.com>"
objEmail.Subject = "CDO Test"
objEmail.Textbody = "This is a message."
objEmail.HTMLBody = "<h1>This is a message.</h1>"
objEmail.Send
Response.Write "OK"
%>