pgrevents Posted May 13, 2009 Share Posted May 13, 2009 I have a a mail function on my website. I want to be able to use html email(which I basicly know how to do) Now the server in which i use i have to use the -fcommand. a working example below <?php mail("[email protected]", "Feedback Form results", "Welcome to the Jungle","From: I-AM-DJ", "[email protected]"); ?> please note that in the from section i use the [email protected] now I am using a basic script that has worked on other servers I use and for the life of me I cannot implament the -f command anywhere and it is driving me mad. the script below <?php // Example $HTML = "<b>This is a test</b>"; $from = "[email protected]"; $to = "[email protected]"; $subject = "I'm sending a test HTML email"; sendHTMLemail($HTML,$from,$to,$subject); function sendHTMLemail($HTML,$from,$to,$subject) { // First we have to build our email headers // Set out "from" address $headers = "From: $from\r\n"; // Now we specify our MIME version $headers .= "MIME-Version: 1.0\r\n"; // Create a boundary so we know where to look for // the start of the data $boundary = uniqid("HTMLEMAIL"); // First we be nice and send a non-html version of our email $headers .= "Content-Type: multipart/alternative;". "boundary = $boundary\r\n\r\n"; $headers .= "This is a MIME encoded message.\r\n\r\n"; $headers .= "--$boundary\r\n". "Content-Type: text/plain; charset=ISO-8859-1\r\n". "Content-Transfer-Encoding: base64\r\n\r\n"; $headers .= chunk_split(base64_encode(strip_tags($HTML))); // Now we attach the HTML version $headers .= "--$boundary\r\n". "Content-Type: text/html; charset=ISO-8859-1\r\n". "Content-Transfer-Encoding: base64\r\n\r\n"; $headers .= chunk_split(base64_encode($HTML)); // And then send the email .... mail($to,$subject,"",$headers); ?> Link to comment https://forums.phpfreaks.com/topic/158002-php-mail-major-confusion/ Share on other sites More sharing options...
pgrevents Posted May 13, 2009 Author Share Posted May 13, 2009 no one? Link to comment https://forums.phpfreaks.com/topic/158002-php-mail-major-confusion/#findComment-833538 Share on other sites More sharing options...
pgrevents Posted May 13, 2009 Author Share Posted May 13, 2009 last bump Link to comment https://forums.phpfreaks.com/topic/158002-php-mail-major-confusion/#findComment-833624 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.