Mail send from vhost

NethServer Version: your_version 7
Module: your_module

Hello
i have some vhosts, which works fine. So i have also a contact form. Sending mail from this, result in a mail from apache@nethserver.mydomain.loc and so it is not send from the Mail in Nethserver.
Is there a way to correct it ?
Thanks for your help

Hello @juergen,

I don’t know your contact form but you should be able to set the from address there, just an example for mailing with php. I think you also have to create a user that matches the from mail address.

<?php
$to = "markus@cmb.local";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "mailuser@cmb.local";
$headers = "From: $from";
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
?> 

Source:

See also:

https://secure.php.net/manual/en/function.mail.php