Is there any way in asp.net that when my page is open on web then an email alert with username should be generate so that i have information that which one is accessing my page
I changed the code like bellow
Public Sub SendMail(ByVal id As String)
Dim message = New MailMessage()
message.IsBodyHtml = True
message.From = New MailAddress("adeel.aslam0@gmail.com")
message.[To].Add(New MailAddress("malik.adeel@shakarganj.com"))
message.Subject = "user access page"
message.Body = "Your Message"
' add id here
Dim client = New SmtpClient("smtp.gmail.com")
client.Send(message)
End Sub
and in web.config like this
<system.net>
<mailSettings>
<smtp from="adeel.aslam0@gmail.com">
<network host="smtp.gmail.com" defaultCredentials="false"
port="587" userName ="adeel.aslam0@gmail.com" password="pass" />
</smtp>
</mailSettings>
</system.net>
You might do something similar..
Modify your
web.configfile to send emailse.g. This use gmail settings
And in your
page_loadif you using
vbtry something like this.This way, you will not need to change your
web.config