Основы работы с XHTML и CSS


Example.11.37


<SCRIPT runat="server">

Sub Submit_Form (Src As Object, Args As EventArgs)

If Email.Text <> "" Then Dim MyEmail = New MailMessage MyEmail.From = "dadams@mail.maconstate.edu" MyEmail.To = Email.Text MyEmail.Subject = "Form Submission" MyEmail.Body = "<h3>Membership Form</h3>" MyEmail.Body &= "<b>First Name = </b> " & FirstName.Text & "<br/>" MyEmail.Body &= "<b>Last Name = </b> " & LastName.Text & "<br/>" If Gender1.Checked Then MyEmail.Body &= "<b>Gender = </b> " & Gender1.Text & "<br/>" ElseIf Gender2.Checked Then MyEmail.Body &= "<b>Gender = </b> " & Gender2.Text & "<br/>" Else MyEmail.Body &= "<b>Gender = </b>Not checked<br/><br/>" End If MyEmail.Body &= "<b>Major = </b> " & Major.SelectedItem.Text & "<br/>" MyEmail.Body &= "<b>Reason = </b> " & Reason.Text & "<br/>" MyEmail.BodyFormat = MailFormat.Html SmtpMail.Send(MyEmail) Message.Text = "Form posted. Check your email." Else Message.Text = "Missing email address. Not posted." End If

End Sub

</SCRIPT>

Листинг 11.37. Серверный сценарий для создания сообщения email из введенных в форму данных

Закрыть окно




Начало  Назад  Вперед



Книжный магазин