I am relatively new to Umbraco
so please excuse me if this is a stupid question. I have developed a site originally
in Visual Studio and I am now moving it onto Umbraco. The site contains several
online forms that use the System.Net.Mail function to send emails from the
from to the client.
Whilst this works fine in the
original development, it doesn't seem to work in Umbraco. How can Umbraco
handle the VB Code that goes with it? I currently get an error message (shown
below)
The code in Question is:
<scriptrunat="server">
ProtectedSub
Submit_btn_Click(ByVal sender AsObject, ByVal e As System.EventArgs)
System.Net.Mail in Umbraco
Hi All
I am relatively new to Umbraco so please excuse me if this is a stupid question. I have developed a site originally in Visual Studio and I am now moving it onto Umbraco. The site contains several online forms that use the System.Net.Mail function to send emails from the from to the client.
Whilst this works fine in the original development, it doesn't seem to work in Umbraco. How can Umbraco handle the VB Code that goes with it? I currently get an error message (shown below)
The code in Question is:
<script runat="server">
Protected Sub Submit_btn_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim body As String
body = "Name: " & Name_txt.Text & vbCrLf & vbCrLf & "Email: " & Email_txt.Text & vbCrLf & vbCrLf & "Phone: " & Tel_txt.Text & vbCrLf & vbCrLf & "Details: " & Detail_txt.Text & vbCrLf & vbCrLf & "Prefered Contact Method: " & ContactMethod_Drop.Text & vbCrLf & vbCrLf & "Time: " & Time_txt.Text & vbCrLf & vbCrLf & "Date: " & Date_txt.Text
SendMail(Email_txt.Text, body)
Name_txt.Text = ""
Email_txt.Text = ""
Tel_txt.Text = ""
Detail_txt.Text = ""
ContactMethod_Drop.Text = ""
Time_txt.Text = ""
Date_txt.Text = ""
End Sub
Private Sub SendMail(ByVal from As String, ByVal body As String)
Dim mailServerName As String = "mail.mailserver.co.uk"
Dim message As MailMessage = New MailMessage(Email_txt.Text, "[email protected]", "Contact Us Request", body)
Dim mailClient As SmtpClient = New SmtpClient
mailClient.Host = mailServerName
mailClient.Send(message)
message.Dispose()
End Sub
</script>
Problem is vb.net. convert your code to c# or try declare language like this:
<%@ Page Language="VB" %>
is working on a reply...