I use this below code to create a random password and I can get the password to disply on the screen.
I want to pass this info on to a database and ASP mail which already is set up but its not passing the password data over
<%
Dim X
Response.Write "<HTML>" & vbCrLf
Response.Write "<HEAD>" & vbCrLf
Response.Write "<TITLE> </TITLE>" & vbCrLf
Response.Write "</HEAD>" & vbCrLf
Response.Write "<BODY>" & vbCrLf
Response.Write "<FONT FACE=COURIER>" & vbCrLf
Response.Write RandomPW(7) & "<br>" & vbCrLf
'Set Length to 0 for random password Length
'Response.Write RandomPW(0) & "<br>" & vbCrLf
Response.Write "</FONT>" & vbCrLf
Response.Write "</BODY>" & vbCrLf
Response.Write "</HTML>" & vbCrLf
Function RandomPW(myLength)
'These constant are the minimum and maximum length for random
'length passwords. Adjust these values to your needs.
Const minLength = 6
Const maxLength = 20
Dim X, Y, strPW
If myLength = 0 Then
Randomize
myLength = Int((maxLength * Rnd) + minLength)
End If
For X = 1 To myLength
'Randomize the type of this character
Y = Int((3 * Rnd) + 1) '(1) Numeric, (2) Uppercase, (3) Lowercase
Select Case Y
Case 1
'Numeric character
Randomize
strPW = strPW & CHR(Int((9 * Rnd) + 48))
Case 2
'Uppercase character
Randomize
strPW = strPW & CHR(Int((25 * Rnd) + 65))
Case 3
'Lowercase character
Randomize
strPW = strPW & CHR(Int((25 * Rnd) + 97))
End Select
Next
RandomPW = strPW
End Function
%>
I then try this and it doesnt grab the RandomPW or strPW what do i need to do
<%
Set mail = Server.CreateObject("Persits.Mailsender"
Mail.Host = "my mail server"
strUserID = request.form("UserID"
strPassword = RandomPW
strEmail = request.form("Email"
Mail.From = strEmail
Mail.FromName = strUserID
Mail.AddBCC "email"
Mail.AddBCC "email"
Mail.AddAddress strEmail
Mail.AddReplyTo strEmail
'Mail.AddAttachment "c:\any file"
strBodyHeader = "" & chr(13) & chr(10) & chr(13) & chr(10)
strBodyHeader = strBodyHeader & "This is your UserID : " & strUserID & chr(13) & chr(10)
strBodyHeader = strBodyHeader & "This is your Password : " & strPassword & chr(13) & chr(10)
strBody = strBodyHeader & strBody
Mail.Subject = ""
Mail.body = strBody
'Mail.Body = "Dear Fan:" & Chr(13) & Chr(10) & "Thank you for your business."
On Error Resume Next
Mail.Send
If Err <> 0 Then
Response.Write "Error encountered: " & Err.Description
End If
%>
I want to pass this info on to a database and ASP mail which already is set up but its not passing the password data over
<%
Dim X
Response.Write "<HTML>" & vbCrLf
Response.Write "<HEAD>" & vbCrLf
Response.Write "<TITLE> </TITLE>" & vbCrLf
Response.Write "</HEAD>" & vbCrLf
Response.Write "<BODY>" & vbCrLf
Response.Write "<FONT FACE=COURIER>" & vbCrLf
Response.Write RandomPW(7) & "<br>" & vbCrLf
'Set Length to 0 for random password Length
'Response.Write RandomPW(0) & "<br>" & vbCrLf
Response.Write "</FONT>" & vbCrLf
Response.Write "</BODY>" & vbCrLf
Response.Write "</HTML>" & vbCrLf
Function RandomPW(myLength)
'These constant are the minimum and maximum length for random
'length passwords. Adjust these values to your needs.
Const minLength = 6
Const maxLength = 20
Dim X, Y, strPW
If myLength = 0 Then
Randomize
myLength = Int((maxLength * Rnd) + minLength)
End If
For X = 1 To myLength
'Randomize the type of this character
Y = Int((3 * Rnd) + 1) '(1) Numeric, (2) Uppercase, (3) Lowercase
Select Case Y
Case 1
'Numeric character
Randomize
strPW = strPW & CHR(Int((9 * Rnd) + 48))
Case 2
'Uppercase character
Randomize
strPW = strPW & CHR(Int((25 * Rnd) + 65))
Case 3
'Lowercase character
Randomize
strPW = strPW & CHR(Int((25 * Rnd) + 97))
End Select
Next
RandomPW = strPW
End Function
%>
I then try this and it doesnt grab the RandomPW or strPW what do i need to do
<%
Set mail = Server.CreateObject("Persits.Mailsender"
Mail.Host = "my mail server"
strUserID = request.form("UserID"
strPassword = RandomPW
strEmail = request.form("Email"
Mail.From = strEmail
Mail.FromName = strUserID
Mail.AddBCC "email"
Mail.AddBCC "email"
Mail.AddAddress strEmail
Mail.AddReplyTo strEmail
'Mail.AddAttachment "c:\any file"
strBodyHeader = "" & chr(13) & chr(10) & chr(13) & chr(10)
strBodyHeader = strBodyHeader & "This is your UserID : " & strUserID & chr(13) & chr(10)
strBodyHeader = strBodyHeader & "This is your Password : " & strPassword & chr(13) & chr(10)
strBody = strBodyHeader & strBody
Mail.Subject = ""
Mail.body = strBody
'Mail.Body = "Dear Fan:" & Chr(13) & Chr(10) & "Thank you for your business."
On Error Resume Next
Mail.Send
If Err <> 0 Then
Response.Write "Error encountered: " & Err.Description
End If
%>