• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Resolved Change header email / Apache invalide : AH00526: Syntax error on line 1

Erwan

Regular Pleskian
Hi all,

I have to put a directive for domain for sending emails using a header with a different domain.
But plesk change the header.
Domain: mydomainA.com
PHP function set this header: [email protected] but Plesk change it by the default [email protected].

So i've found this: https://support.plesk.com/hc/en-us/...n-are-rejected-on-some-recipient-mail-servers

But if i add the following line to the additional configuration directives:
sendmail_path="/usr/sbin/sendmail -t -i -f [email protected]"

I've this error:
Configuration Apache invalide : AH00526: Syntax error on line 1 of /var/www/vhosts/system/mydomainA.com/conf/vhost_ssl.conf: Invalid command 'sendmail_path="/usr/sbin/sendmail', perhaps misspelled or defined by a module not included in the server configuration

And there isn't directory "conf" in /var/www/vhosts/system/mydomainA.com/.
How can i solve the problem?
Is there another way to impose a header or disable Plesk header by default for a domain?

Thank you

Erwan
 
Hi Peter,

No, this is not the header that i want.

I want "From": [email protected]
But Plesk change it to: [email protected] (default domain).

PHP
$to = '[email protected]';
$subject = 'Test';
$message = 'Hello !';
$headers = 'From: [email protected]' . "\r\n" .
'Reply-To: [email protected]' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);


But the email i receive:
Subject: Test A
Reply-To: <[email protected]> OK
X-Mailer: PHP/8.1
X-PPP-Message-ID: <.......>
From: [email protected] NOT OK / CHANGE BY PLESK
X-PPP-Vhost: mydomainA.com


So i've try this to force: https://support.plesk.com/hc/en-us/...n-are-rejected-on-some-recipient-mail-servers
But i can not save, i've this error:
Configuration Apache invalide : AH00526: Syntax error on line 1 of /var/www/vhosts/system/mydomainA.com/conf/vhost_ssl.conf: Invalid command 'sendmail_path="/usr/sbin/sendmail', perhaps misspelled or defined by a module not included in the server configuration
 
So i've try this to force: https://support.plesk.com/hc/en-us/...n-are-rejected-on-some-recipient-mail-servers
But i can not save, i've this error:
Configuration Apache invalide : AH00526: Syntax error on line 1 of /var/www/vhosts/system/mydomainA.com/conf/vhost_ssl.conf: Invalid command 'sendmail_path="/usr/sbin/sendmail', perhaps misspelled or defined by a module not included in the server configuration

I've tested setting sendmail_path="/usr/sbin/sendmail -t -i -f [email protected]" to the PHP additional configuration directives on a domain on my server and that worked without any issue. What Plesk version are you running?
 
Last edited:
Obsedian 18.0.34 / Centos 7.9 / FPM by Apache

If i put command in "Additional Apache directives", error:
Configuration Apache invalide : AH00526: Syntax error on line 1 of /var/www/vhosts/system/mydomainA.com/conf/vhost_ssl.conf: Invalid command 'sendmail_path="/usr/sbin/sendmail', perhaps misspelled or defined by a module not included in the server configuration

If i put command in PHP "Additional directives", no error but header still the same.
 
The command needs to go into the PHP additional directives, not Apache. It has nothing to do with the web server, but only with PHP.

Have you tried to add the 5th parameter to the mail() function as described above?
 
Peter,

So i've added in the the PHP additional directives:
sendmail_path="/usr/sbin/sendmail -t -i -f [email protected]"

And my PHP function:
$to = '[email protected]';
$subject = 'Test';
$message = 'Hello !';
$headers = 'From: [email protected]' . "\r\n" .
'Reply-To: [email protected]' ;

//$additionnal_param = "-f [email protected]";
$additionnal_param = "[email protected]";
mail($to, $subject, $message, $headers, $additionnal_param);

No error when i execute but i still receive email from [email protected].

Subject: Test A
Reply-To: <[email protected]> ==> OK
X-Mailer: PHP/8.1
X-PPP-Message-ID: <....>
From: [email protected] ==> NOT OK
X-PPP-Vhost: mydomainA.com
Message-ID: <....>
Date: Wed, 8 Mar 2023 11:52:48 +0100
Return-Path: [email protected] ==> NOT OK
 
Peter,

Because i've found example on the php documentation without whitespace: PHP: mail - Manual
But i've also tested with a whitespace:

$to = '[email protected]';
$subject = 'Test';
$message = 'Hello !';
$headers = 'From: [email protected]' . "\r\n" .
'Reply-To: [email protected]' . "\r\n" .

'Return-Path: [email protected]';
$additionnal_param = "-f [email protected]";
mail($to, $subject, $message, $headers, $additionnal_param);

Same result...

Subject: Test A
Reply-To: <[email protected]>
...
From: [email protected]
...
...
Date: Wed, 8 Mar 2023 13:12:32 +0100
Return-Path: [email protected]
...
 
What is the setting of Tools & Settings > Mail > Mail Server Settings > Fix incorrectly set sender for outgoing mail. Is this on or off? Does it change the result when you toggle it?
 
Grrrr.. yes it change...
It was on. When i turn off, email is correct.

It is possible to turn on (this is a server with multiple clients) and to desactivate this option for one domain only?
 
Back
Top