CDO.Message参数问题 [英] CDO.Message parameter problem
问题描述
我正在尝试使用CDO从我的ASP应用程序发送邮件,我的
问题是这个。
如果我在.To中使用字符串字段即me@myco.com"如果我将
值更改为记录集页面失败的结果,那么
页面工作正常并发送邮件。
我用过response.write检查recorset
包含一个有效的电子邮件地址,这似乎没问题。
我的代码是下面列出。
Dim iMsg
Dim iConf
Dim Flds
set iMsg = CreateObject( CDO.Message)
set iConf = CreateObject(" CDO.Configuration")
Const cdoSendUsingPort = 2
Set Flds = iConf.Fields
随着Flds
。我们
(" http://schemas.microsoft.com/cdo/configuration/sendusing"
)= cdoSendUsingPort
。项目
(" http://schemas.microsoft.com/cdo/configuration/smtpserver >
")=" localhost"
。项目
(" http://schemas.microsoft.com/cdo/configuration/smtpconnec
tiontimeout")= 10
。更新
结束
''查找用户电子邮件地址
set myRecordSet = myUser.getUserEmailAddress (Request.form
(" cboAssignTo"))
emailto = myRecordSet(0)
emailTitle =" Email Alert"
emailFrom =" al *** @ iHotdesk.com"
sBody =" Call Description:xxxxxx" &安培; vbcr
with iMsg
Set .Configuration = iConf
.To = emailto
。 = emailFrom
.Subject = emailTitle
.TEXTBody = sBody
。发送
结束
非常感谢任何帮助。
谢谢
>值是记录集页面失败的结果。
你能更具体一点吗?
-
Aaron Bertrand
SQL Server MVP
http: //www.aspfaq.com/
" Paul" < PA ******** @ ihotdesk.com>在消息中写道
news:08 **************************** @ phx.gbl ... < blockquote class =post_quotes>我正在尝试使用CDO从我的ASP应用程序发送邮件,我的
问题是这个。
如果我在.To字段中使用字符串即 me@myco.com"
页面工作正常,邮件发送,如果我将
值更改为记录集页面失败的结果。
您确定您使用的smtp服务器会将邮件中继到外部
地址吗?如果它没有配置为中继,它可以接受本地
域名的邮件,但拒绝远程域名。
Tony
Aaron
代码中的
我在发送邮件之前对所选用户的电子邮件地址进行查询
如下: br />
----------------------------------------
''查找用户的电子邮件地址
设置myRecordSet = myUser.getUserEmailAddress(Request.form
(" cboAssignTo"))
emailto = myRecordSet(0)
---------------------------------- --------
这将返回用户的电子邮件地址,但是如果我将.To字段设置为
如下:
.To = emailto
页面失败,但如果我设置
.To =" an **** @ abc.com"
它有效。记录集用电子邮件地址弹出,我用
response.write来验证内容。
尽管最糟糕的是我可以使用内容来自
地址(.From = emailto)没有任何问题。
问候,
Paul
http: //www.developersdex.com ***
不要只是参加USENET ......获得奖励!
I am trying to send mail from my ASP app using CDO, my
problem is this.
If I use a string in the .To field ie "me@myco.com" the
page works fine and the mail is sent, if I change the
value to be the result of a recordset the page fails.
I have used a response.write to check the recorset
contains a valid email address, this appears to be fine.
My code is listed below.
Dim iMsg
Dim iConf
Dim Flds
set iMsg = CreateObject("CDO.Message")
set iConf = CreateObject("CDO.Configuration")
Const cdoSendUsingPort = 2
Set Flds = iConf.Fields
With Flds
.Item
("http://schemas.microsoft.com/cdo/configuration/sendusing"
) = cdoSendUsingPort
.Item
("http://schemas.microsoft.com/cdo/configuration/smtpserver
") = "localhost"
.Item
("http://schemas.microsoft.com/cdo/configuration/smtpconnec
tiontimeout") = 10
.Update
End With
''lookup users email address
set myRecordSet = myUser.getUserEmailAddress(Request.form
("cboAssignTo"))
emailto = myRecordSet(0)
emailTitle = "Email Alert"
emailFrom = "al***@iHotdesk.com"
sBody = "Call Description: xxxxxx " & vbcr
With iMsg
Set .Configuration = iConf
.To = emailto
.From = emailFrom
.Subject = emailTitle
.TEXTBody = sBody
.Send
End With
Any help greatfully appreciated.
Thanks
> value to be the result of a recordset the page fails.
Could you be a little more specific?
--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
"Paul" <pa********@ihotdesk.com> wrote in message
news:08****************************@phx.gbl...I am trying to send mail from my ASP app using CDO, my
problem is this.
If I use a string in the .To field ie "me@myco.com" the
page works fine and the mail is sent, if I change the
value to be the result of a recordset the page fails.
Are you sure that the smtp server you are using will relay mail to external
addresses? If it''s not configured to relay it may accept mail for a local
domain but reject remote domains.
Tony
Aaron
in the code I perfrom a lookup on the selected users email address
before sending the mail as follows:
----------------------------------------
''lookup users email address
set myRecordSet = myUser.getUserEmailAddress(Request.form
("cboAssignTo"))
emailto = myRecordSet(0)
------------------------------------------
This returns the users email address, however if I set the .To field as
follows:
.To = emailto
The page fails, however if I set
.To = "an****@abc.com"
it works. The recordset is poplated with an email address, I have used
response.write to verify the contents.
The wierdest thing though is that I can use the contents as the from
address (.From = emailto) without any problems.
Regards,
Paul
*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!
这篇关于CDO.Message参数问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!