Add from field in php form

Discussion in 'Coding Help' started by links, Dec 8, 2011.

Tags:
  1. links

    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";
     
  2. dropbop

    dropbop New Member

    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);
    
     

Share This Page