• The APS Catalog has been deprecated and removed from all Plesk Obsidian versions.
    Applications already installed from the APS Catalog will continue working. However, Plesk will no longer provide support for APS applications.
  • Please be aware: with the Plesk Obsidian 18.0.78 release, the support for the ngx_pagespeed.so module will be deprecated and removed from the sw-nginx package.

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