Fra PHP til ASP
Er der en der hurtigt kan lave nedenstående kode om til ASP?<?php
// Purpose:
// script should be called from Flash with params to send a mail to a user.
// input Params:
// "name" - the name of the sender (required)
// "message" - The message from the sender (required)
// "email" - the emailadress of the sender (required)
// "recipient" - the emailadress of the receiver (required)
// "subject" - the subject of the mail (required)
// variable declarations
$mailTest = false; // bool. knows if mail has been send correctly of not
$messageText = ""; // string. the text to be inserted into the mail besides the received message param.
$return = "false"; // string. true/false string which is shown on the page (ie. to flash)
// Contraints check
// Only simple constraint check for whether param is sent at all
// uses exit() to stop prg. Syntax:
// void exit ( [string status])
if ($name == "") {exit ( "mailSent=False\r\nERROR: param not received: name");}
if ($message == "") {exit ( "mailSent=False\r\nERROR: param not received: message");}
if ($email == "") {exit ( "mailSent=False\r\nERROR: param not received: email");}
if ($recipient == "") {exit ( "mailSent=False\r\nERROR: param not received: recipient");}
if ($subject == "") {exit ( "mailSent=False\r\nERROR: param not received: subject");}
// build the messageText:
$messageText = $name . "\r\n";
$messageText .= "has submitted the following email from the Abekongen online contact form: \r\n\r\n";
$messageText .= $message;
// send mail using the mail() function. syntax:
// bool mail ( string to, string subject, string message [, string additional_headers [, string additional_parameters]])
$mailTest = mail ( $recipient, $subject, $messageText,
"From: " . $name . "<" . $email . ">\r\n"
."Reply-To: " . $name . "<" . $email . ">\r\n"
."X-Mailer: PHP/" . phpversion());
// Generate response (for Flash).
if ($mailTest == true) {$return = "true";}
else {$return = "false";}
echo "mailSent=" . $return;
?>
