need help in sending mail

indianswz

Newcomer
Joined
Mar 27, 2004
Messages
14
hi......friends,

i have a form for users to get their password emailed to them after they submit their userid and email address. i am able to send email and also receive in the email account but it contains only the userid but password doesn't appear in the mail..........i am pasting below the code for u all to have a look and help me where is the problem............
-------------------------------
Sub dosend(ByVal Source As Object, ByVal E As EventArgs)
Dim uid1,email1 As String
Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("Database\.users.mdb") & ";"
Dim MySQL As String = "Select uid,pwd,email from login " & _
"Where uid = '" & frmuid.Text & "' and email = '" & frmemail.Text & "'"
Dim MyConn As New OleDbConnection(strConn)
Dim objDR As OleDbDataReader
Dim Cmd As New OleDbCommand(MySQL, MyConn)
MyConn.Open()
objDR = Cmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection)

If Not objDR.Read() Then
label1.Text = "Sorry - your user ID & email were not found"
objDR.Close()
MyConn.Close()
Else
While objDR.Read()
frmuid.text= objDR("uid")
sendpwd.text = objDR("pwd")
frmemail=objDR("email")

End While

Dim sMsg as String
sMsg+="Hi there - here's the information you requested." & vbcrlf
sMsg+="Username : " & frmuid.Text & vbcrlf
sMsg+="Password : " & sendpwd.text & vbcrlf

Dim objEmail as New MailMessage()
objEmail.To=frmemail.text
objEmail.BCC="x@hotmail.com " '<--- this would be where you can send it to yourself at the same time.
objEmail.FROM="x@hotmail.com"


objEmail.SUBJECT=""
objEmail.BODY=sMsg
objEmail.BodyFormat = MailFormat.Text
SmtpMail.SmtpServer ="localhost"
SmtpMail.Send(objEmail)
Response.redirect("login.aspx")
End If
End Sub
--------------------

this was the code by which i am able to send email....... sendpwd.text is the hidden textbox on the form in which i am trying to get the value of password and then send it in mail........

help me in solving this problem or anyone has a better sample example for this then send it.......

Thanks in Advance
 
Back
Top