| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Help with email
I have a website that is password controlled, but the ASP script I have uses CDONTS to sent the "lost password" through a MS Access Database. I have tried and tried to modify it to use JMail or Bamboo and cannot get either to work. Does anyone have coding for sending the user via their email address, their password. The CDONTS code I cannot use is posted below. Any help would be great!
<%Response.Buffer=TRUE%> <% 'here is the connection string Set conn = server.createobject("adodb.connection") 'this connection uses JET 4 it is the prefered method of connecting to an access database DSNtemp = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath("database name and loc.") 'if you cant use JET then comment out the line above and uncomment the line below 'DSNtemp="DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.Mappath("database name and loc.") conn.Open DSNtemp 'here we are getting the info from the lost password form uid = Request.Form("T1") SQL = "Select * From users Where uid = '" & uid & "'" Set RS = Conn.Execute(SQL) 'HERE WE CHECK TO MAKE SURE THE USERS EMAIL EXISTS, IF IT DOES, WE EMAIL IT If NOT RS.EOF Then Dim mytxt 'HERE YOU CAN ASSIGN ANY TEXT YOU LIKE TO GO IN THE EMAIL WITH THE PASSWORD, LEAVE IT IN THE QUOTES!!! mytxt = "Here is your password:" Dim ObjMail Set ObjMail = Server.CreateObject("CDONTS.NewMail") ' if the email address exists then the info is sent here ObjMail.To = RS("uid") '############################### CHANGE THE EMAIL BELOW TO YOUR ADMIN EMAIL '############################### leave it in the quotes!!!!! Objmail.From = "johnpwiles@yahoo.com" ObjMail.Subject = "Lost Password" 'HERE IS THE BODY SENDING PASSWORD ObjMail.Body = mytxt & vbcrlf&_ RS("pwd") ObjMail.Send Set ObjMail = Nothing x = "Your Password Will Be Sent To The Email Address You Are Registered With" Else 'IF THE EMAIL DOES NOT EXIST WE TELL THE BELOW x = "Sorry The Email Address You Entered Does Not Exist" End If %> <html> <head> <title>Lost Password</title> </head> <body> <center><%=x%></center> </body> </html> |
|
#2
|
||||
|
||||
|
Try changing this:
Code:
Set ObjMail = Server.CreateObject("CDONTS.NewMail")
' if the email address exists then the info is sent here
ObjMail.To = RS("uid")
'############################### CHANGE THE EMAIL BELOW TO YOUR ADMIN EMAIL
'############################### leave it in the quotes!!!!!
Objmail.From = "johnpwiles@yahoo.com"
ObjMail.Subject = "Lost Password"
'HERE IS THE BODY SENDING PASSWORD
ObjMail.Body = mytxt & vbcrlf&_
RS("pwd")
ObjMail.Send
Set ObjMail = Nothing
Code:
Set JMail = Server.CreateObject ("JMail.SMTPMail")
JMail.ServerAddress = "mail.yourdomain.com"
JMail.Sender = "johnpwiles@yahoo.com"
JMail.Subject = "Lost Password"
JMail.AddRecipient RS("uid")
JMail.Body = mytxt & vbcrlf&_
RS("pwd")
JMail.Priority = 3
JMail.Execute
Set JMail = Nothing
__________________
selwonk If I've posted some code above, you might think it looks a bit simplistic. It might be. I'd rather people tried the next step themselves rather than getting a full solution on a plate. That way they learn more! |
![]() |
| Viewing: ASP Free Forums > Programming > Code Bank > Help with email |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|