• The new Python extension is now available. It allows customers to deploy and manage WSGI-based Python applications on their websites directly from Plesk.
  • Debian 11 has reached its end-of-life (vendor EOL date - August 31, 2026). Plesk Obsidian 18.0.81 is the last release to support it.
    If you are running Plesk Obsidian on Debian 11, we recommend you upgrade those servers to Debian 12 using our dist-upgrade tool.
  • We plan to deprecate and remove the support for XML RPC protocol versions earlier than 1.6.9.1 in Plesk Obsidian 18.0.82. We strongly recommend that you update all existing integrations using earlier versions of the XML RPC protocol to comply with the version 1.6.9.1 specification.

php mail, I can't solve this one, it must be simple

L

lawrencebrown

Guest
Hello,

First off, I must apologize, this topic has been covered loads and I have given it hours of my time now and I am still not getting anywhere. I am just trying to get the php mail function to send through my server. I have used this script time and time again with no problem - until on this server with plesk.

Can anyone advise on the changes that need to be made to ensure the emails get delivered?


<?php
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

// *** Mail form as Text format ***
if (isset($_POST["FX_sendForm"]) && $_POST["FX_sendForm"] == "contact") {
$top = "\n";
$body = "\n";
$excludeArray = array("submit","submit_x","submit_y","null","FX_sendForm","MM_insert","MM_update");
$i = 0;
while ($i<sizeof($_POST)) {
if (!in_array(key($_POST),$excludeArray)) {
if (is_array(pos($_POST))) {
$postVar = implode(", ", pos($_POST));
} else {
$postVar = pos($_POST);
}
$body .= strtoupper(key($_POST)) . ": " . stripslashes($postVar) . "\n";
}
$i++;
Next($_POST);
}


$bottom = "\n";
$from = $_POST["Name"];
// set parameters
$recipient = "[email protected]";
$subject = "Message title";
$message = $top . $body . $bottom;
// set extra parameters
$headers = "From: " . $from . "\n";
$headers .= "Cc: \n";
$headers .= "Bcc: \n";
// send all
mail($recipient, $subject, $message, $headers);
$body = urlencode(str_replace("\n", "<br>", $body));
$redirect = "index.php";
if ($redirect) header("Location: " . $redirect);
}
?>


Thanks in advance. Lawrence
 
Back
Top