P
Paul
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 "(e-mail address removed)" 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 = "(e-mail address removed)"
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
problem is this.
If I use a string in the .To field ie "(e-mail address removed)" 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 = "(e-mail address removed)"
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