![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| sendmail only sends emails to its own domain | jjwood64 | AIX | 3 | 01-24-2008 12:27 PM |
| mail command woth Postfix | piltrafa | UNIX for Dummies Questions & Answers | 1 | 12-18-2007 08:34 AM |
| Configuring my PostFix Mail Server | fundidor | UNIX for Dummies Questions & Answers | 4 | 06-01-2004 09:43 AM |
| Cron Sends mail to root on completion of job. | skotapal | UNIX for Dummies Questions & Answers | 1 | 04-25-2003 05:27 PM |
| Linux mail servers benchmarks (Qmail, Sendmail,Postfix) | cipango | News, Links, Events and Announcements | 0 | 07-26-2002 02:30 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
PHP Script that sends mail - Postfix breaks it
I have a PHP Script that works perfectly on a server that uses Sendmail. However I tried to port it to a new server that has the Postfix to Sendmail compatibility interface, and it doesn't work properly.
The php.ini file has the path for sendmail on both servers set to: /usr/sbin/sendmail -t -i Here is the PHP function. Code:
function send_email($from, $to, $subject, $textMsg, $htmlMsg = ''){
$from = stripslashes($from);
$subject = stripslashes($subject);
$textMsg = stripslashes($textMsg);
if (eregi("\r",$from) || eregi("\n",$from)){
die("Sorry, the from addess is invalid. If you feel you have gotten this message in error, please contact the system administrator.");
}
if (eregi("\r",$to) || eregi("\n",$to)){
die("Sorry, the to addess is invalid. If you feel you have gotten this message in error, please contact the system administrator.");
}
if (eregi("\r",$subject) || eregi("\n",$subject)){
die("Sorry, the subject is invalid. If you feel you have gotten this message in error, please contact the system administrator.");
}
if($htmlMsg > ''){
$body = "\r\n--gc0p4Jq0M2Yt08j34c0p\r\n" .
"Content-Type: text/plain; charset=us-ascii; format=flowed\r\n" .
"Content-Transfer-Encoding: 7bit\r\n\r\n" .
"$textMsg\r\n\r\n" .
"--gc0p4Jq0M2Yt08j34c0p\r\n" .
"Content-Type: text/html; charset=us-ascii;\r\n" .
"Content-Transfer-Encoding: 7bit\r\n\r\n" .
"$htmlMsg\r\n";
}else{
$body = "\r\n--gc0p4Jq0M2Yt08j34c0p\r\n" .
"Content-Type: text/plain; charset=us-ascii; format=flowed\r\n" .
"Content-Transfer-Encoding: 7bit\r\n\r\n" .
"$textMsg\r\n\r\n";
}
$hdr = "Mime-Version: 1.0\r\n" .
"From: $from\r\n" .
"Reply-To: $from\r\n" .
"Content-Type: multipart/alternative; boundary=\"gc0p4Jq0M2Yt08j34c0p\"\r\n" .
"Date: " . date('r') . "\r\n";
mail($to, $subject, $body, $hdr) ;
}
========= From: jeff@emailhere1.com Reply-To: jeff@emailhere1.com Content-Type: multipart/alternative; boundary="gc0p4Jq0M2Yt08j34c0p" Date: Tue, 04 Mar 2008 21:37:21 -0500 Message-Id: <20080305023721.169903A415D@serverhostname.com> X-Spam: [F=0.6145044964; B=0.500(0); CM=0.500; MH=0.500(2008030474); R=0.600(10824171516); S=0.515(2008012801); SS=0.500; SC=none] X-MAIL-FROM: <apache@serverhostname.com> X-SOURCE-IP: [99.999.999.999] X-AnalysisOut: [v=1.0 c=0 a=PJwPNPI7AAAA:8 a=5tm0iYomoMYUE1dKbXIA:9 a=ZnIH] X-AnalysisOut: [FGK1kxZMqYugtdp_urtXkEMA:4 a=TZyYahp_f9YA:10 a=YH6K3Mh3ZBA] X-AnalysisOut: [A:10] Return-Path: apache@serverhostname.com X-OriginalArrivalTime: 05 Mar 2008 02:37:21.0739 (UTC) FILETIME=[D69DC9B0:01C87E69] --gc0p4Jq0M2Yt08j34c0p Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit email body is here |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|