SitePoint Sponsor

User Tag List

Results 1 to 1 of 1
  1. #1
    imagine no limitations exbabylon's Avatar
    Join Date
    Dec 2000
    Location
    Idaho, USA
    Posts
    452
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am currently using PHP to send reports to my client. Here is an example:

    Code:
    <?php
    $foo = explode("[", $foo);
    $main = "";
    foreach($foo as $bar){
    $bar = ereg_replace("]", "", $bar);
    $bar = explode("|", $bar);
        foreach($bar as $foobar){
            $main .= "<tr><td>$foobar[0]</td><td>$foobar[1]</td><td>$foobar[2]</td><td>$foobar[4]</td><td>$foobar[3]</td></tr>";
        }
    }
    
    mail("user@mydoman.com", "Report", "Here is your report for today<p><table>$main</table>", "Content-Type: text/html");
    ?>
    The $main variable gets up to 60-70 rows. However, I am experiencing problems with this. Not my script, but the mail() function.

    When I send this to any address on MY domain, it truncates the $main vairable after about 1500 characters. But, if I send it to my local internet provider, me@myisp.com it sends through PERFECT! Odd huh?

    I used two re-write of the function:

    Code:
    function n_mail($fromaddress, $toaddress, $subject, $body, $headers) { 
    $fp = popen('/usr/sbin/sendmail -f'.$fromaddress.' '.$toaddress,"w"); 
    if(!$fp) return false; 
    fputs($fp, "To: $toaddress\n"); 
    fputs($fp, "Subject: $subject\n"); 
    fputs($fp, $headers."\n\n"); 
    fputs($fp, $body); 
    fputs($fp, "\n"); 
    pclose($fp); 
    return true; 
    }
    
    function o_mail($from, $to , $subject,$core_msg, $add_header) 
    { 
    
    $cmd_line=sprintf("/usr/sbin/sendmail -t");
    $fp=popen($cmd_line,"w"); 
    $temp=sprintf("To: %s\n",$to); 
    $len=strlen($temp); 
    $ret_p=fputs($fp,$temp,$len); 
    $temp=sprintf("Subject: %s\n",$subject); 
    $len=strlen($temp); 
    $ret_p=fputs($fp,$temp,$len); 
    if ($add_header != "") 
    { 
    $temp=sprintf("%s\n",$add_header); 
    $len=strlen($temp); 
    $ret_p=fputs($fp,$temp,$len); 
    } 
    $temp=sprintf("\n%s\n",$core_msg); 
    $len=strlen($temp); 
    $ret_p=fputs($fp,$temp,$len); 
    pclose($fp); 
    }
    They both work the same as the mail() function, and thus, have the same exact problems!

    So, I looked into my hosts PHP.INI file... they sent it to me. Here is the code around the mail part of it:

    Code:
    mail function]
    SMTP			=	localhost			;for win32 only
    sendmail_from	=	me@localhost.com	;for win32 only
    ;sendmail_path	=						;for unix only, may supply arguments as well (default is sendmail -t)
    They say they are using procmail to deliver mail locally. I have yet to find a cure for this. It is NOT feasible to send this email to a host OTHER than user@mydomain.com so I must find a cure for this. Mabey a SMTP connection? I'm not sure... but I need to find out!

    I am hoping that mabey some of you can help me with this delema. If you still need clarification here is an example of what I might get in my message when sent to me@mydomain.com

    Code:
    Here is your report for today<p><table><tr><td>a1</td><td>a2</td><td>a3</td><td>a4</td><td>a5</td></tr><tr><td>b1</td><td>b2</td><td>b3</td><td>b4</td><td>b5</td></tr><tr><td>c1</td><td>c2</td><td>c3</td><td>c4</td><td>c5</td></tr><tr><td</table>
    See where the begining of the last <td> is like <td without the closing > This happens in different spots depending upon the length of the $bar variables.

    I have sendmail setup... and I can access it just fine for using CGI and formmail etc.

    God Bless, and hope you can help me!
    Last edited by exbabylon; Apr 4, 2001 at 12:43.
    Blamestorming: Sitting around in a group discussing why a deadline was missed or a project failed and who was responsible.

    Exbabylon- Professional Internet Services


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •