Witam,
Przeniosłem stronę z serwera IIS na Apache, teraz wywala mi się formularz zgłoszeniowy bo oczywiście używano biblioteki do maili dla Windows. Skrypt wygląda następująco:
<?php
//*** Start the session. ***
//*** Define Upload Temp Directory ***
$target_path = ini_get('upload_tmp_dir'); //*** Initialize the loop count *** No File
$loopcount = 0;
if (basename($_FILES['THEFILE-1']['name']) != ""){ $loopcount = 1;
}
if (basename($_FILES['THEFILE-2']['name']) != "") {
$loopcount = 2;
}
if (basename($_FILES['THEFILE-3']['name']) != "") {
$loopcount = 3;
}
//*** Decide whether there is a file to upload ***
if ($loopcount == 0){
//*** Create mail body ***
$msg_body = $_REQUEST['txtFname'] . "<br>";
$msg_body .= $_REQUEST['txtCname'] . "<br>";
$msg_body .= $_REQUEST['txtTitle'] . "<br>";
$msg_body .= $_REQUEST['txtEmail'] . "<br>";
$msg_body .= $_REQUEST['txtPhone'] . "<br>";
$msg_body .= $_REQUEST['txtAdd1'] . "<br>";
if(trim($_REQUEST['txtAdd2']) != ""){ $msg_body .= $_REQUEST['txtAdd2'] . "<br>";
}
$msg_body .= $_REQUEST['txtCity'] . ", " . $_REQUEST['State'] . ", " . $_REQUEST['txtZip'] . "<br>";
$msg_body .= $_REQUEST['Country'] . "<br><br>";
$msg_body .= "Languages: " . $_REQUEST['Slang'] . " TO " . $_REQUEST['TLang'] . "<br><br>";
$msg_body .= "Date Required: " . $_REQUEST['dd'] . "-" . $_REQUEST['mm'] . "<br><br>";
if(trim($_REQUEST['txtNotes']) != ""){ $msg_body .= "Notes: " . $_REQUEST['txtNotes'] . "<br><br>";
}
$msg_body .= "Worked with us before: " . $_REQUEST['b4now'] . "<br>";
$msg_body .= "How you found us: " . $_REQUEST['found'] . "<br>";
$msg_body .= "Keyword used or referral: " . $_REQUEST['keyword'] . "<br>";
if(isset($_SESSION['page'])){ $msg_body .= "PPC Point of entry: " . $_SESSION['page'] . "<br>";
}
//*** Generating Mail CDO ***
$message = new Mail('CDO.Message');
//*** Email used for Live Form ***
$message->To = 'services@example.com';
$message->From = 'dedicated@example.com';
$message->Subject = 'Web submission: | From www.example.com';
$message->HTMLBody = $msg_body;
$message->Send();
header("Location: <a href="http
://www.example.com/Translation-Services/Free-Quote-Confirmation.php"%3b%29;" target="_blank">http://www.example.com/Translation-Service...ion.php");</a> }
else{
//*** Define Mail to be sent ***
//*** Create mail body ***
$msg_body = $_REQUEST['txtFname'] . "<br>";
$msg_body .= $_REQUEST['txtTitle'] . "<br>";
$msg_body .= $_REQUEST['txtCname'] . "<br>";
$msg_body .= $_REQUEST['txtEmail'] . "<br>";
$msg_body .= $_REQUEST['txtPhone'] . "<br>";
$msg_body .= $_REQUEST['txtAdd1'] . "<br>";
if(trim($_REQUEST['txtAdd2']) != ""){ $msg_body .= $_REQUEST['txtAdd2'] . "<br>";
}
$msg_body .= $_REQUEST['txtCity'] . "<br>";
$msg_body .= $_REQUEST['State'] . "<br>";
$msg_body .= $_REQUEST['Country'] . "<br>";
$msg_body .= $_REQUEST['txtZip'] . "<br><br>";
$msg_body .= "Languages: " . $_REQUEST['Slang'] . " TO " . $_REQUEST['TLang'] . "<br><br>";
$msg_body .= "Date Required: " . $_REQUEST['dd'] . "-" . $_REQUEST['mm'] . "<br><br>";
if(trim($_REQUEST['txtNotes']) != ""){ $msg_body .= "Notes: " . $_REQUEST['txtNotes'] . "<br><br>";
}
$msg_body .= "Worked with us before: " . $_REQUEST['b4now'] . "<br>";
$msg_body .= "How you found us: " . $_REQUEST['found'] . "<br>";
$msg_body .= "Keyword used or referral: " . $_REQUEST['keyword'] . "<br>";
if(isset($_SESSION['page'])){ $msg_body .= "PPC Point of entry: " . $_SESSION['page'] . "<br>";
}
//*** Loop through for file upload ***
for ($i = 1; $i <= $loopcount; $i++) {
$file_from_field = "THEFILE-" . $i;
$uploadfile = $target_path . "\\" . basename($_FILES[$file_from_field]['name']);
$f_name_no_spaces = basename($_FILES[$file_from_field]['name']); $f_name_no_spaces = str_replace(" ","%20", $f_name_no_spaces);
$msg_body .= "Link to File: <a href=\"http://www.example.com/php-upload-fold/" . $f_name_no_spaces . "\">Click here</a><br><br>";
$uploaded_file_flag = 1;
}
}
if ($uploaded_file_flag == 1){
//*** Generating Mail CDO ***
$message = new COM('CDO.Message');
//*** Email used for Live Form ***
$message->To = 'services@example.com';
$message->From = 'dedicated@example.com';
$message->Subject = 'Web submission: | From www.example.com';
$message->HTMLBody = $msg_body;
$message->Send();
header("Location: <a href="http
://www.example.com/Translation-Services/Free-Quote-Confirmation.php"%3b%29;" target="_blank">http://www.example.com/Translation-Service...ion.php");</a> }
else{
header("Location: <a href="http
://www.example.com/nogo.html"%3b%29;" target="_blank">http://www.example.com/nogo.html");</a> }
}
?>
Oczywiście domyślam się że chodzi o tą funkcję:
$message = new Mail('CDO.Message');
Pytanie jakiej biblioteki i jak użyć żeby się nie narobić przy przerabianiu?