I'm having some issues in understanding how to send custom headers with the php mail()
function.
What's wrong with this code?
<?php
function send_email($name, $lastname, $from, $subject, $message){
$to = 'to_adress@gmail.com';
$headers = 'To: ' . $to .
'\r\nFrom: ' . $from .
'\r\nSubject:' . $subject;
mail($to, $subject, $message, $headers);
print 'Email sent';
}
send_email('jhon', 'doe', 'from_adress@gmail.com', 'subject', 'message');
?>
It gives me no php error, and the email does not arrive.