|
 |
asp_web_howto thread: How to email customers their passwords if they have forgotten them
Message #1 by "Lance Kirby" <lkirby@g...> on Tue, 9 Jul 2002 22:45:13
|
|
Hi,
I am having a bit of trouble in figuring out how to email my customers
their passwords if the have forgotten them I have the web page set up but
it's the script that i am having trouble with here is what i have so far.
what i am tring to do is when they input their email address is have the
script go to the customers database and select all the customers and fine
that person email then email them their password.
<%@ LANGUAGE = "VBScript" %>
<!-- #include file="store_db.inc" -->
<!-- #include file="store_config.inc" -->
<!-- #include file="store_functions.inc" -->
<%
stage=request.querystring("stage")
email=valid_sql(request.form("email"))
pass=valid_sql(request.form("pass"))
action=request.form("action")
'Check if user is already signed in
if session("custid")<>"" and session("custid")<>null then
response.redirect("store_deliver.asp")
end if
set rsverify=db.execute("select * from customers where email='" & email
& "'")
if rsverify.eof then
db.close
set db=nothing
response.redirect("get_password.asp?msg=" &
Server.URLEncode("We don't have any record of the email address you
entered.<br>Please review the information you entered or register as a
new user."))
end if
%>
<!-- #include file="top_nav.htm" -->
<font face="arial">
<%
header
categorymenu
%>
<center>
<table>
<td valign=top align=right>
<font face="helvetica" size="6" color="<%= COLdark %>">
<br>
<p align="center">
Thank You
<br><font face="helvetica, arial" size="2" color="<%= text %>">
· Your password will be emailed to you within a few
minutes.<br>
<font face="helvetica" size="2" color="<%= COLerror %>">
<b><%= request.querystring("msg") %></b><br>
<font face="helvetica" size="2" color="<%= text %>">
</font>
<% footer %><!-- #include file="footer.htm" --></body></html><%
db.close
set db=nothing
%>
Message #2 by "Sandra" <salau@p...> on Tue, 9 Jul 2002 23:55:35
|
|
Hi there!
You probably want to make use of the CDONTS object, which comes with ASP.
I'm thinking you're using VBScript, so this might help you.
set objMail = Server.CreateObjects("CDONTS.NewMail")
objMail.To = "recipient@s..."
objMail.From = "sender@s..."
objMail.Subject = "Subject of mail"
objMail.Body = "blah, blah, blah" & aVar & "more blah"
objMail.Send
set objMail = nothing
And that should send out an email! There's also
.cc, .bcc, etc.
You can probably put this in a function and trigger the function if a
user's mail address is found. :)
HTH, Sandra
> Hi,
> I am having a bit of trouble in figuring out how to email my customers
t> heir passwords if the have forgotten them I have the web page set up
but
i> t's the script that i am having trouble with here is what i have so far.
> what i am tring to do is when they input their email address is have the
s> cript go to the customers database and select all the customers and
fine
t> hat person email then email them their password.
> <%@ LANGUAGE = "VBScript" %>
<> !-- #include file="store_db.inc" -->
<> !-- #include file="store_config.inc" -->
<> !-- #include file="store_functions.inc" -->
<> %
s> tage=request.querystring("stage")
> email=valid_sql(request.form("email"))
p> ass=valid_sql(request.form("pass"))
a> ction=request.form("action")
>
'> Check if user is already signed in
i> f session("custid")<>"" and session("custid")<>null then
> response.redirect("store_deliver.asp")
e> nd if
> set rsverify=db.execute("select * from customers where email='" & email
&> "'")
> if rsverify.eof then
> db.close
> set db=nothing
> response.redirect("get_password.asp?msg=" &
S> erver.URLEncode("We don't have any record of the email address you
e> ntered.<br>Please review the information you entered or register as a
n> ew user."))
e> nd if
> %>
<> !-- #include file="top_nav.htm" -->
<> font face="arial">
<> %
h> eader
> categorymenu
%> >
>
> <center>
<> table>
> <td valign=top align=right>
> <font face="helvetica" size="6" color="<%= COLdark %>">
> <br>
> <p align="center">
> Thank You
> <br><font face="helvetica, arial" size="2" color="<%= text %>">
> · Your password will be emailed to you within a few
m> inutes.<br>
>
>
> <font face="helvetica" size="2" color="<%= COLerror %>">
> <b><%= request.querystring("msg") %></b><br>
> <font face="helvetica" size="2" color="<%= text %>">
>
<> /font>
<> % footer %><!-- #include file="footer.htm" --></body></html><%
d> b.close
s> et db=nothing
%> >
|
|
 |