Author Topic: tool to send a complete page content by mail  (Read 402 times)

0 Members and 1 Guest are viewing this topic.

Offline isaac_cmTopic starter

  • Enthusiast
  • Posts: 319
    • View Profile
tool to send a complete page content by mail
« on: May 30, 2007, 12:13:27 PM »
Hello,
I know how to use mail() function and it work fine with me but I am wondering if there is a tool or a way to just pass the the desired page to send to mail address with all its content (graphics+HTML+PHP) , any idea ?

Notice: I can only use mail() function no smtp available

thanks

Offline chigley

  • Devotee
  • Posts: 957
  • Gender: Male
  • PHP 5.2.1 ¦ mySQL 4.1.21 ¦ Apache 1.3.37
    • View Profile
Re: tool to send a complete page content by mail
« Reply #1 on: May 30, 2007, 12:16:26 PM »
Code: [Select]
<?php

ob_start
();

// The rest of your page here

$output ob_get_contents();

mail("you@domain.com""Page Contents"$output);

?>

You mean like that?

Offline obsidian

  • Managed Insanity
  • Staff Alumni
  • Freak!
  • *
  • Posts: 6,440
  • Gender: Male
  • Talk to me, I won't bite... hard.
    • View Profile
    • Guahan Web
Re: tool to send a complete page content by mail
« Reply #2 on: May 30, 2007, 01:15:54 PM »
A few things to keep in mind: first, any images on the page will have to be attached and handled as Embedded images within the content of your email. With this in mind, IMHO, there would be a 3 step process to get what you're after:

1. Screen scrape the desired page to get your markup.
2. Parse and download all images used within the markup.
3. Substitute the img tags with embedded images, attaching the matching downloaded images to the message.

You would have to write up a fairly complex algorithm to come up with a working model (especially considering that many images may be served up via CSS as well).

If you use a tool for your actual mailing such as PHPMailer, step 3 above would be very easy. It's step two that would be the most difficult, IMHO. Just making sure that you had all the images from the page could be quite tricky.

Hope this gives some direction.
You can't win, you can't lose, you can't break even... you can't even get out of the game.

Code: [Select]
<?php
while (count($life->getQuestions()) > 0)
{   
$life->study(); } ?>
  LINKS: PHP: Manual MySQL: Manual PostgreSQL: Manual (X)HTML: Validate It! CSS: A List Apart | IE bug fixes | Zen Garden | Validate It! JavaScript: Reference Cards RegEx: Everything RegEx

Offline isaac_cmTopic starter

  • Enthusiast
  • Posts: 319
    • View Profile
Re: tool to send a complete page content by mail
« Reply #3 on: May 30, 2007, 07:00:08 PM »
sorry but I dont understand you completely if there a good example please tell me about it

I also need to output php script from some variables or objects

I use the following header , it work but only with HTML
//============================================
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= "From:".$senderRealName."<".$senderEmailAddress.">\r\n";
$headers .= "Reply-To:".$senderEmailAddress."\r\n";
$headers .= "Importance: Normal\r\n";
$headers .= "Subject:".$emailSubject."\r\n";
$headers .= "X-Priority: 3\r\n";
$headers .= "X-Sender:".$senderEmailAddress."\r\n";
$headers .= "X-MSMail-Priority: Normal\r\n";
$headers .= "X-Mailer: PHP/".phpversion()."\r\n";
$headers .= "X-Server: ".$_SERVER['SERVER_NAME']."\r\n";
$headers .= "X-Host: ".$_SERVER['HTTP_HOST']."\r\n";

Offline isaac_cmTopic starter

  • Enthusiast
  • Posts: 319
    • View Profile
Re: tool to send a complete page content by mail
« Reply #4 on: May 30, 2007, 07:43:45 PM »
I need to send shopping cart content through mail my car look like this:

<?php
if (!$my_ecart->IsEmpty())     {
?>
                          <table  width="85%" cellpadding="5" cellspacing="0" class="S1B_Layout">
                            <tr>
                              <td colspan="7" class="S1B_CartTitle">Shopping Basket </td>
                              </tr>
                            <tr valign="top" class="S1B_ColumnHeaderRow">
                              <td width="8%" align="center" class="S1B_ColumnHeader">Code</td>
                                <td width="37%" align="left" class="S1B_ColumnHeader">Name</td>
                                <td width="6%" align="center" class="S1B_ColumnHeader">Size</td>
                                <td width="16%" align="center" class="S1B_ColumnHeader">Colour</td>
                                <td width="7%" align="center" class="S1B_ColumnHeader">QTY</td>
                                <td width="11%" align="center" class="S1B_ColumnHeader">Price</td>
                                <td width="15%" align="center" class="S1B_ColumnHeader">Total</td>
                              </tr>
                            <?php
  $A_ItemRowStyle_1 = array();
    $A_ItemRowStyle_1[0] = "S3B_RowOdd";
  $A_ItemRowStyle_1[1] = "S3B_RowEven";
  $A_ItemRowStyle_1=new A_eCartDisplayCSSLooper($A_ItemRowStyle_1);
  ?>
                            <?php
while (!$my_ecart->EOF())      {
?>
                              <tr class="<?php echo $A_ItemRowStyle_1->ReturnNextIndex(); ?>">
                                <td valign="top" align="center" class="S1B_FirstColumnItem"><?php echo $my_ecart->DisplayInfo("prodsku"); ?></td>
                                  <td valign="top" align="left" class="S1B_Name"><?php echo $my_ecart->DisplayInfo("Name"); ?></td>
                                  <td valign="top" align="center" class="S1B_ColumnItem"><?php echo $my_ecart->DisplayInfo("opt1size"); ?></td>
                                  <td valign="top" align="center" class="S1B_ColumnItem"><?php echo $my_ecart->DisplayInfo("opt2color"); ?></td>
                                  <td valign="top" align="center" class="S1B_ColumnItem"><?php echo $my_ecart->DisplayInfo("Quantity"); ?></td>
                                  <td valign="top" align="center" class="S1B_ColumnItem"><?php echo A_eCart_Show($my_ecart, $my_ecart->DisplayInfo("Price")); ?></td>
                                  <td valign="top" align="center" class="S1B_ColumnItem"><?php echo A_eCart_Show($my_ecart, $my_ecart->DisplayInfo("TotalPrice")); ?></td>
                                </tr>
                              <?php
  $my_ecart->MoveNext();
}
$my_ecart->MoveFirst();
?>
                            <tr>
                              <td colspan="7" class="S1B_OrderTitle">Order Summary</td>
                              </tr>
                            <tr valign="top">
                              <td colspan="6" class="S1B_Subtotal">Sub-Total</td>
                                <td class="S1B_SubtotalPrice"><?php echo A_eCart_Show($my_ecart, $my_ecart->TotalColumn("TotalPrice")); ?></td>
                              </tr>
                            <tr>
                              <td colspan="6" class="S1B_OrderHeader">Postage &amp; Packing</td>
                                <td align="right" class="S1B_OrderLineItem"><?php echo A_eCart_Show($my_ecart, $my_ecart->GetCharges()); ?></td>
                              </tr>
                            <tr valign="bottom">
                              <td colspan="6" class="S1B_OrderTotal">Total</td>
                                <td align="right" class="S1B_OrderTotal"><?php echo A_eCart_Show($my_ecart, $my_ecart->GrandTotal()); ?></td>
                              </tr>
                            </table>
                            <?php
//A eCart Show If Middle
}
else     {
?>
  <table class="S3B_Layout">
    <tr><td class="S3B_CartTitle">The cart is empty</td></tr>
  </table>
                          <?php
//A eCart Show If End
}
?>

//========================================
there is also CSS used here so I think I have to attach the CSS file using only mail() func, please advice
thanks
« Last Edit: May 30, 2007, 07:53:09 PM by isaac_cm »

Offline isaac_cmTopic starter

  • Enthusiast
  • Posts: 319
    • View Profile
Re: tool to send a complete page content by mail
« Reply #5 on: May 31, 2007, 10:09:52 AM »
oops  :D

I figure out how to output php variables

if there is any other tools than phpmailer please post

thanks