I am using PHP's mail() function and realizing that my mail has been proven from being sent by 'My Website' during my mailbox, however when I click the actual email it shows it being sent from mywebsite@sitename.localdomain.

Ideally Let me get it say being sent from 'My Website', however the reply email being 'no-reply@mywebsite.com', and not have it say anything about @sitename.localdomain.

$to = trim(strtolower($_POST['to']));
$from = trim($_POST['from']);
$message = trim($_POST['message']);

$subject = $from . ' has shared a link with you';
$headers = 'From: My Website' . "\r\n" .
        'Reply-To:' . $to . "\r\n" .
        'X-Mailer: PHP/';


mail($to, $subject, $message, $headers);

Is an problem that I have to fix in Apache, or can one customize the headers within PHP?

Do this:

$to = trim(strtolower($_POST['to']));
$from = trim($_POST['from']);
$message = trim($_POST['message']);

$subject = $from . ' has shared a link with you';
$headers = 'From: My Website <no-reply@mywebsite.com>' . "\r\n" . // <- change your email here
        'Reply-To:' . $to . "\r\n" .
        'X-Mailer: PHP/';


mail($to, $subject, $message, $headers);