I am new to programming and I am using a book as a tutorial.
I am trying to send email using a button click, but I get an error message saying that mailmessage is used before it is assigned a variable.
<%@ Import Namespace="System.net.mail" %>
<script runat=server>
Sub button_click(ByVal s As Object, ByVal e As EventArgs)
Dim mailmessage As SmtpClient
mailmessage.Send( _
"paul.cook@mosaic.net.nz", _
"paul_bfc@hotmail.com","Sending Mail!", "Hello")
End Sub
</script>
<html>
<head runat="server">
</head>
<body>
<form runat="server">
<asp:Button OnClick="button_click" runat=server />
</form>
</body>
</html>
I am trying to send email using a button click, but I get an error message saying that mailmessage is used before it is assigned a variable.
<%@ Import Namespace="System.net.mail" %>
<script runat=server>
Sub button_click(ByVal s As Object, ByVal e As EventArgs)
Dim mailmessage As SmtpClient
mailmessage.Send( _
"paul.cook@mosaic.net.nz", _
"paul_bfc@hotmail.com","Sending Mail!", "Hello")
End Sub
</script>
<html>
<head runat="server">
</head>
<body>
<form runat="server">
<asp:Button OnClick="button_click" runat=server />
</form>
</body>
</html>