@{
var customerName = Request["customerName"];
var customerEmail = Request["customerEmail"];
var customerRequest = Request["customerRequest"];
var subjectLine = Request["subjectLine"];
var fileAttachment = Request["fileAttachment"];
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";
// Create array containing file name
var filesList = new string [] { fileAttachment };
// Attach file and send email
WebMail.Send(to: customerEmail,
subject: subjectLine,
body: "File attached.
From: " + customerName,
filesToAttach: filesList);
}
catch (Exception ex ) {
errorMessage = ex.Message;
}
}
Sorry to hear that you are having trouble, @customerName.
@if(errorMessage == ""){@customerName, thank you for your interest.
An email message has been sent to our customer service department with the @fileAttachment file attached.
} 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
} }