About the author
As a systems manager, no doubt one had to handle complaints and feedbacks from customers.
A nifty utility I've developed while working in a company using server technology such as Cold Fusion, is to allow customers to provide complaints and feedbacks using a web form.
I've ported the concept of providing customer feedback into ASP.NET and Delphi, and the code below is a complete application that allows you to get feedback from customers with such a form.
<%@ Page Language="Delphi" debug="true" ContentType="text/html" ResponseEncoding="utf-8" %>
<%@ Page Language="Delphi" debug="true" ContentType="text/html" ResponseEncoding="utf-8" %><%@Import Namespace="System.Web.Mail"%><html><head><title>Feedback</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>
<script language="Delphi" runat="server">procedure SendFeedback(Sender: System.Object; E: EventArgs);var mail: MailMessage;begin try mail := MailMessage.Create; mail.&To := 'Your Name <yourname@yourorg.org>'; mail.From := From.Text; mail.Subject := 'Feedback'; mail.Body := Message.Text;
mail.Headers.Add('X-Organization', 'Your Organization');
// SMTP authentication - Remove if not needed mail.Fields['http://schemas.microsoft.com/cdo/configuration/smtsperver'] := 'mysmtpserver'; mail.Fields['http://schemas.microsoft.com/cdo/configuration/sendusername'] := 'myusername'; //set your username here mail.Fields['http://schemas.microsoft.com/cdo/configuration/sendpassword'] := 'mypassword'; //set your password here
SmtpMail.SmtpServer := 'mysmtpserver'; SmtpMail.Send(mail); Message.Text := ''; except on E: Exception do Message.Text := 'Your message was not delivered due to an error. Please retry at a later time.'; end; end;</script>
<body><form runat="server"><strong>From:</strong> <asp:textbox ID="From" ReadOnly="false" runat="server" TextMode="SingleLine" /><br>Feedback:<br><asp:textbox Columns="80" ID="Message" ReadOnly="false" Rows="10" runat="server" TextMode="MultiLine" /><br> <asp:button runat="server" Text="Send Feedback" OnClick="SendFeedback" runat="server"/></form>
</body></html>
A method pointer is now the same as a global procedure, ie, procedure of object = procedure.