Add from field in php form

Advert test


New Member
I currently have a form that I am using on a site, however I would like to add code so my Gmail knows that it is arriving from a safe address. some emails have been going into the spam folder. Can you assist please

I tried to place email address in below code but no joy.

$headers .= 'From: '.$cf_email."\r\n";
$headers .= 'From: '.$cf_email."\r\n";
This is how I use it and it works fine :)

$to = "";
    $subject = "This is an email subject";
    $from = "";
    $headers = "From:" . $from;
    $body = "
    Hi $name,\n\n 
    Thank you for visiting my website etc etc etc. \n\n 
    mail($to, $subject, $body, $headers);