TypeScript
@{
var customerName = Request["customerName"];
var customerEmail = Request["customerEmail"];
var customerRequest = Request["customerRequest"];
var errorMessage = "";
var debuggingFlag = false;
try {
// Initialize WebMail helper
WebMail.SmtpServer = "your-SMTP-host";
WebMail.SmtpPort = 25;
WebMail.UserName = "your-user-name-here";
WebMail.Password = "your-account-password";
WebMail.From = "your-email-address-here";
// Send email
WebMail.Send(to: customerEmail,
subject: "Help request from - " + customerName,
body: customerRequest
);
}
catch (Exception ex ) {
errorMessage = ex.Message;
}
}
Request for Assistance
Sorry to hear that you are having trouble, @customerName.
@if(errorMessage == ""){
An email message has been sent to our customer service
department regarding the following problem:
@customerRequest
}
else{
The email was not sent.
Please check that the code in the ProcessRequest page has
correct settings for the SMTP server name, a user name,
a password, and a "from" address.
if(debuggingFlag){
The following error was reported:
@errorMessage
}
}

Rajeesh MenothRank #118 · 18.4K reputationPosted Oct 19, 2016, 1:30 AM EDT