email php

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • epots9
    Recognized Expert Top Contributor
    • May 2007
    • 1352

    email php

    i'm trying to email a php file as the message for an email but i want it to be displayed as if it were viewed by a browser, cuz right now the email contains the srouce code.

    mail code:
    [PHP]
    $filename = "text.php";
    $handle = fopen($filename , "r");
    $contents = fread($handle, filesize($filen ame));
    fclose($handle) ;
    print mail($_GET["emailTo"], $_POST["QuoteNum"]." Quote Order", $contents);
    [/PHP]

    open to all suggestions
  • mwasif
    Recognized Expert Contributor
    • Jul 2006
    • 802

    #2
    Use the webaccessible path to get the output and use that ourput in the email.
    [PHP]$output = file_get_conten ts("http://www.yourdomain. com/text.php");[/PHP]

    Comment

    • epots9
      Recognized Expert Top Contributor
      • May 2007
      • 1352

      #3
      Originally posted by mwasif
      Use the webaccessible path to get the output and use that ourput in the email.
      [PHP]$output = file_get_conten ts("http://www.yourdomain. com/text.php");[/PHP]
      i get this error
      Code:
      Warning: file_get_contents(): Circular redirect, aborting. in /var/www/html/summary.php on line 93
      
      Warning: file_get_contents(http://www.mydomain.com/text.php?method=all): failed to open stream: Success in /var/www/html/summary.php on line 93
      **paths have been edited so they are not visible
      line 93:
      [PHP]
      print mail($_GET["emailTo"], $_POST["QuoteNum"]." Quote Details", file_get_conten ts("http://www.mydomain.co m/text.php?method =all"), "MIME-Version: 1.0\r\nContent-type: text/html; charset=iso-8859-1");
      [/PHP]
      **paths have been edited so they are not visible

      Comment

      • pbmods
        Recognized Expert Expert
        • Apr 2007
        • 5821

        #4
        Heya, epots9.

        Check out highlight_file( ).

        Comment

        • epots9
          Recognized Expert Top Contributor
          • May 2007
          • 1352

          #5
          Originally posted by pbmods
          Heya, epots9.

          Check out highlight_file( ).
          same error as before "Circular redirect"

          Comment

          • epots9
            Recognized Expert Top Contributor
            • May 2007
            • 1352

            #6
            i got it working, i just had to remove an if statement that tested my session.

            Comment

            Working...