Add from field in php form

Status
Not open for further replies.

links

New Member
Hi,
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";
 

dropbop

New Member
$headers .= 'From: '.$cf_email."\r\n";

This is how I use it and it works fine :)

Code:
$to = "user@yoursite.com";
    $subject = "This is an email subject";
    $from = "you@youremail.com";
    $headers = "From:" . $from;
    $body = "
    Hi $name,\n\n 
    Thank you for visiting my website etc etc etc. \n\n 
    ";
    mail($to, $subject, $body, $headers);
 
Status
Not open for further replies.
Top