rbftp Posted March 11, 2003 Share Posted March 11, 2003 This was found in one of tje General forums, but was locked. Where would I install this function to work with osCommerce? Hello All I have had a heck of a time getting PHP to send out confirmation emails on my server, and I have seen countless complaints on the list about this. So I have written my own tep_mail using the popen command that bypasses the php mail command completely. I am running Postfix, a sendmail replacement that is working flawlessly on my server except that PHP will not talk to it using the built-in mail command. Must be some permissions problem?? With this new function my_tep_mail, I am able to reliably send out confirmation emails, every time. I have also added the capability to add a few more parameters to tep_mail, with a bit of error checking as well. I am happy, I hope some of you can use it as well. Note the use of sendmail -oi -oem option to allow spoofing Return-Path headers. Good Luck Alan Young function my_tep_mail($toAddress, $subject, $message, $additional_headers = '', $to_name,$from_name,$fromAddress,$replyAddress) { if (trim($to_name)=="") { $to_name="Shopping Customer";}; if (trim($toAddress) == "") { $toAddress="[email protected]";}; if (trim($fromAddress)=="") { $fromAddress="[email protected]";} if (trim($subject)=="") { $subject="My Sales Update";}; if (trim($replyAddress)=="") { $replyAddress="[email protected]";}; $recipient =$toAddress; /* additional header pieces for errors, From cc's, bcc's, etc */ $headers .= "X-Sender: " . $fromAddress. "n"; $headers .= "X-Mailer: PHP Scriptn"; // mailer $headers .= "X-Priority: 1n"; // Urgent message! $headers .= "Return-Path: " . $fromAddress. "n"; // Return path for errors /* If you want to send html mail, uncomment the following line */ // $headers .= "Content-Type: text/html; charset=iso-8859-1n"; // Mime type // $headers .= "Bcc: [email protected]"; // BCCs $LocationOfSendmail="/usr/sbin/sendmail"; if (($fp = popen($LocationOfSendmail . " -oi -oem -f"" . $fromAddress . """ ,"w"))!=0) { $out = "From: " . $fromAddress . "n"; $out .= "To: " . $recipient ."n"; $out .= "Subject: " . $subject . "n"; if ($headers != "") { $out .= $headers ."n"; } $out .= "n"; $out .= $message ."n"; fputs($fp,$out); pclose($fp); return 1; } else { return 0; } } Link to comment Share on other sites More sharing options...
rbftp Posted March 11, 2003 Author Share Posted March 11, 2003 Anyone? Link to comment Share on other sites More sharing options...
rbftp Posted March 12, 2003 Author Share Posted March 12, 2003 What about the guy who posted this topic? Link to comment Share on other sites More sharing options...
rbftp Posted March 12, 2003 Author Share Posted March 12, 2003 Any Technical Guys? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.