Reply
Old 05-28-2004, 12:07 PM CDO Email Help
Junior Talker

Posts: 1
Trades: 0
Ok, I have this CDO email script that I would like to be able to use to send a user their username and password when requested.

The problem is that I can't seem to be able to use a variable in the .To Property of the CDO.Configuration Class. Can anyone help? Here is my script:

'-----------------------------------------------------
'Create Objects
Dim objMessage, objConfig
Set objMessage = Server.CreateObject("CDO.Message")
Set objConfig = Server.CreateObject("CDO.Configuration")

'Create Configuration
With objConfig.Fields
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.whatever.com"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10
.Update()
End With

Test = Trim(Request.Form("email"))


'Send Email
With objMessage
.Configuration = objConfig
.To = Test
.From = "blah@blah.com"
.Subject = "Requested Information"
.HTMLBody = "This message is being sent because you requested your login information from <a href=""http://www.blah.com"">http://www.blah.com</a>.<br><br>Your information is as follows:<br><ul><li>User Name = " & member("username") & "</li><li>Password = " & member("password") & "</li></ul><br>"
End With

'Destroy Objects
Set objMessage = Nothing
Set objConfig = Nothing

response.redirect("cardless.asp?msg=s")

'----------------------------------------------------
vasdawg is offline
Reply With Quote
View Public Profile
 
 
When You Register, These Ads Go Away!
Old 05-31-2004, 06:06 AM
Average Talker

Posts: 16
Trades: 0
It may be for the purpose of the example but remember to put the address in (") quotation marks. Another thing I always do is delare a variable like:

Dim EmailTo, EmailFrom

Emailto = "you@you.com"
EmailFrom = "me@me.com"

Then the part of your code that is (.To = ) would be (.To = EmailTo)
TopGun is offline
Reply With Quote
View Public Profile
 
Old 05-31-2004, 06:07 AM
Average Talker

Posts: 16
Trades: 0
Oh and get rid of the response.redirect
TopGun is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to CDO Email Help
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 



Page generated in 0.12925 seconds with 13 queries