Hi
By getting the email id from txtEmailId, I have to send the user name & password to that particular email id. For that on button click event I have given the coding as -
-
Protected Sub imgSend_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles imgSend.Click
-
-
If txtEmailId.Text = "" Then
-
WebMsgBox.Show("Please enter your email address and try again.")
-
End If
-
-
-
Dim ob As String
-
Dim ob1 As String
-
Dim con As SqlConnection
-
Dim cmd As SqlCommand
-
Dim str, str1 As String
-
Dim rd As SqlDataReader
-
str = "user id=sa;password=cast;database=jsc;server=AURORA-SERVER"
-
con = New SqlConnection(str)
-
Try
-
con.Open()
-
Catch
-
End Try
-
str1 = "select loginid,password from login where email='" & Trim(txtEmailId.Text.ToString()) & "' "
-
cmd = New SqlCommand(str1, con)
-
rd = cmd.ExecuteReader()
-
While (rd.Read())
-
ob = rd.GetValue(1).ToString()
-
ob1 = rd.GetValue(2).ToString()
-
-
End While
-
Dim cnt As Int16
-
cnt = cmd.ExecuteScalar()
-
If cnt <= 0 Then
-
WebMsgBox.Show("The email address you entered does not match our records. Please check your entry and try again.")
-
Else
-
Dim msg As New Net.Mail.MailMessage("important.project@gmail.com", txtEmailId.Text, "Re: Info", "User Id='" & ob & "' Password='" & ob1 & "'")
-
Dim mySmtp As New Net.Mail.SmtpClient("IP ADDRESS")
-
Try
-
mySmtp.Send(msg)
-
Label1.Text = "Mail Sent"
-
Catch ex As Exception
-
Label2.Text = ex.Message
-
Label1.Text = ex.InnerException.Message
-
End Try
-
End If
-
con.Close()
-
End Sub
-
-
Here I have retrived the user name & password from database, stored it in a variable & used the variables in the line as
-
-
Net.Mail.MailMessage("important.project@gmail.com", txtEmailId.Text, "Re: Info", "User Id='" & ob & "' Password='" & ob1 & "'")
-
-
Instead of passing the variable ob,ob1 as
-
"User Id='" & ob & "' Password='" & ob1 & "'"
-
is there any other way to pass those variable.
4 1674
Your approach looks OK (to me). Any reason why don't want to pass the parameters like that?
Your approach looks OK (to me). Any reason why don't want to pass the parameters like that?
I think this link will help you;
http://msdn.microsoft.com/en-us/library/system.net.mail.mailmessage.aspx
Dim msg As New Net.Mail.MailMessage("important.project@gmail.com" , txtEmailId.Text, "Re: Info", "User Id='" & ob & "' Password='" & ob1 & "'")
In the above line I have specified the
Message body- it should be simply specified in "".
All that we entered inside the "" are considered simply as a text.So if I enter the user name & password DB values then it consider it (" & ob & "') also as the text that is inside.
Dim msg As New Net.Mail.MailMessage("important.project@gmail.com" , txtEmailId.Text, "Re: Info", "User Id='" & ob & "' Password='" & ob1 & "'")
In the above line I have specified the
Message body- it should be simply specified in "".
All that we entered inside the "" are considered simply as a text.So if I enter the user name & password DB values then it consider it (" & ob & "') also as the text that is inside.
What is the user Id and password supposed to be for?
The MailMessage class certainly doesn't need them.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Allan Hugo |
last post by:
Not a programmin newbie, but a PHP newbie.
I'm working off the user authentication and database thing off
hotscripts.com.
It doesn't work, yet from what I can see, it should.
Maybe I've...
|
by: Ken Nistler |
last post by:
Hello, I was wondering if anyone can help me out.
I am trying to send mail from a c# app thru my ISP pop3 mail server. I
figured it would be similar to using SMTP, but use my username and...
|
by: Ivan Weiss |
last post by:
I have an application where employees fill out forms and they are
e-mailed to the responsibility party once completed. I was planning on
using Microsoft Outlook (since everyone uses it for office...
|
by: splicemix |
last post by:
Hi all,
I have recently set up a Drupal website. I am a beginner. My shared
host server does not allow nobody@localhost to send emails, and
prevents access to php.ini, so I spent some time...
|
by: Eric Sheu |
last post by:
Greetings,
I have been searching the web like mad for a solution to my SMTP problem. I
am using Windows Server 2003 and ASP.NET 2.0 w/ C# to send out e-mails from a
web site I have created to...
|
by: GoneRural |
last post by:
Hello, I am trying to figure out how can I run a process under the
authenticated user's credentials without having to prompt for a
username and password? Is there anyway to allow for pass thru...
|
by: kang jia |
last post by:
hi
when user entered particulars in signuppage and click" signup" button, i will direct them to do_signup.php. if say the NRIC is dupicate in datebase, i will redirect them back to signup page...
|
by: Allie |
last post by:
Hi, all.
I'm new to C# programming. I'm even newer to programming email
capabilities into my code. What I need to do is create three (3)
functions:
* sendEmail, using a Mail object (which needs...
|
by: trivedimca2005 |
last post by:
I am using below code for sending Email using .net.
Its not working on client machine. My server IP is:- 192.168.10.10 and also uses proxy and user-name and password for proxy settings are...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |