Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

send /receive mail with asp and cdonts 3

Status
Not open for further replies.

terror

Programmer
Aug 22, 2001
86
US
I understand how to send mail using CDONTS. I've followed the basic code and it works fine. I want to use email to confirm a subscription similar to what you'd see on most sites where the person confirming just needs to hit reply and send. I know that I can use the 'reply-to' to change where the response goes.
What I want to do is this:
When a new user submits a form, it passes the info to my database and flags a newUser field with a 1. At the same time an email is sent to the new user to confirm his subscription. Once he responds, I want newUser field in my database to be a 0. I just don't know where to start in retrieving info when the new user responds to my email. I would like to be able to have the response sent to an asp page that grabs his email address and checks it against the database, if it exists and it's newUser field is a 1, change the 1 to a 0.
Is this possible? Or am I making it harder than it needs to be?
I've read that you can't use cdonts to receive, only to send. Is there a common trick of the trade for setting this up? I am working on win2k with IIS
thankyou kindly
-Terror
 
i don't think cdonts can receive mail. you would need another com object, such as AspPOP3 that could receive email. and from what i've read, that is one of the prime applications for it.
 
Terror,

One thing you can do is create a hyerlink on the email that you're sending with the users email address or some userid in the querystring and have it access an ASP on your server that will confirm the subscription.

Need help with that ??

ToddWW :)
 
Todd's suggestion is probably the most reasonable. Minimal output of effort with maximum results. Way to go, Todd!
 
Todd,
as a matter of fact...I do need help with that. If you don't have the time, can you send me to a good tutorial on it. I have not yet messed around with hyperlink strings and variables and all that. I'm learning as I go.
yeah, I need help please
thanks,
Terror
 
Sure, I'd be glad to help.

What information do they provide to you at the time they submit their desire to subscribe ?? Just an email address, or are you getting a host of other information about them as well.

ToddWW :)
 
another quick question while we're at it...
In my form that sends the email out, do I use the
CDONTS.NewMail or the CDONTS.Session? or does it not matter in this case?
 
At the moment, I'm taking in the basics I have 4 fields
NAME,EMAIL ADDRESS,PASSWORD, RE-TYPE PASSWORD
I'm using javascript to do a basic form validation.
I think that is all I really need at this time.
thanks for the quick response dude!
 
CDONTS.NewMail is fine.

Waiting for the answer to my previous reply ..

ToddWW
 
got your CDONTS.NewMail reply, I have to leave shortly...will you be around tomorrow at all to pick this up with me again? I'm gonna be bombarded with kids soon and it makes it a little difficult to concentrate if ya know what I mean.
thanks man.
 
No problem, I'll be here tomorrow. My previous question that I needed an answer on was this.

What information do they provide to you at the time they submit their desire to subscribe ?? Just an email address, or are you getting a host of other information about them as well.


Also could you send me the ASP code you're using to send the mail ??

ToddWW
 
I answered it already but maybe you missed it. I am using 4 basic fields
name, email address, password, re-type password.
Very basic for now. My database has these fields in it
id (primary key)
user
password
email
newUser(boolean)
okay mentor, I'll catch you tomorrow, if you happen to be around early and you have time, put up a post and I'll know you're there. Thanks again Todd.
 
Hey Todd, sorry I Forgot to post the code,
I don't have it all on my form yet..I just learned how to send the mail with this code. I figure setting up the variables for the recipient is easy enough. I just did not do it yet. so i still have to put this into my registration form

<%
dim objSession
dim objOutbox
dim objNewMsg

set objSession = server.createObject(&quot;CDONTS.session&quot;)
objSession.logonSMTP &quot;Sender Name&quot;, &quot;mydomain.com&quot;
set objOutbox = objSession.Outbox

set objNewMsg = objOutbox.messages.add
objNewMsg.subject = &quot;this is the subject&quot;
objNewMsg.text = &quot;this is the body&quot;
objNewMsg.recipients.add &quot;recipient name&quot;, &quot;recipientDomain.com&quot;, CdoTo
objNewMsg.send
objSession.logoff
%>
 
I would say your URL (in the body of the email) would look something like this:


Trusting that when you add their initial submission to a database you generate an id number for them. Then in the confirm.asp you would use:

sql = &quot;UPDATE USERS SET Users_Confirm = 'yes' WHERE Users_Id = '&quot; & Request.QueryString(&quot;id&quot;) & &quot;' AND Users_Email = '&quot; & Request.QueryString(&quot;email&quot;) & &quot;'&quot;

Using the id/email address pair to ensure they don't just change the querystring to a random id number potentially confirming some John Doe out there.

Or if you don't set a User Id upon form submission, it probably wouldn't hurt to just use the email address in the query string, if they had multiple submissions with the same email address it would confirm all of them. But they're email address should be unique.
 
Terror,

Lobstah took the words right out of my mouth. That's exactly what you want to do. Let us know if you need any more help with that.

ToddWW :)
 
Todd, i have to catch up with you tomorrow...too much going on here at the moment, so i will go thru your post and try and make it work and if I can't you'll be hearing from me again. thanks again...and again :)
 
LOBSTAH,
So sorry, I thought you were Todd, I'm reading too fast.
Thankyou kindly
much obliged... :)
 
Todd,
I thought that was probably what you were getting at. Didn't want to steal your thunder, though.... You had built right up to it so well. :p
 
No worries.. You saved me alot of time..

I'll get you back ;-)

ToddWW
 
To lobstah and ToddWW,
thanks for the help guys. I seem to be on the right track now. Much obliged.
cheers,
Terror
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top