Hi there, I have a PHP script that will compile a page and I would like it to compile the information on the page into a .msg file ready to send in outlook. I would like the subject to be set and the email recipient. Here is my code so far. <form method="post" action="process.php" /> Auction Name: <input type="text" name="id"/> Email: <input type="text" name="email" /> <input type="submit" /> </form> HTML: <?php $url = 'http://www.trademe.co.nz/Browse/Listing.aspx?id=' . $id; $page = file_get_contents($url); preg_match('/<h1 id="ListingTitle_title">(.*?)<\/h1>/s', $page, $pre_title); $title = trim(html_entity_decode($pre_title[1])); preg_match('/<li id="ListingTitle_auctionTitleBids">Winning bid: \$(.*?)<\/li>/s', $page, $pre_price); $price = trim(html_entity_decode($pre_price[1])); preg_match('/<ul id="AuctionSaleDetail_ShippingDetailsList"><li>\$(.*?) /s', $page, $pre_shipping_price); $shipping_price = trim(html_entity_decode($pre_shipping_price[1])); $sub_total = $price+$shipping_price; $total = number_format($sub_total, 2); echo "<html>\n"; echo "<p>Dear Customer,</p>\n"; echo "<p>This email is to inform you that we are awaiting payment for your recent item.</p>\n"; echo "<p>Amount to pay (including shipping): $$total</p>\n"; echo "<p>First Last<br>\n"; echo " Bank of New Zealand<br>\n"; echo " xx-xxxx-xxxxxxx-xxx</p>\n"; echo "<p>Reference #: $id<br>\n"; echo " Failure to use this reference number may result in delays in shipping.</p>\n"; echo "<p>Kind Regards,<br>\n"; echo " First Last</p>\n"; echo " </html>\n"; ?> PHP: I don't have a clue what I would need to put in the process.php file. Any help, much appreciated.
Nah you've got the wrong end of the stick. I want to know what I need to put into the process.php to make the static output be a .msg file that I can open to send to someone. Thanks!
It appears that you want to send an HTML email, correct? Not a problem! Here is ONE example: http://www.php.net/manual/en/function.mail.php
If you're going to send mail right in your php script then look at the php mail function above. If you're going to send mail manually using outlook with attachment then you want to write the output into static file using fopen,fwrite to do that. $filecontent = "<html>\n"; $filecontent .= "<p>Dear Customer,</p>\n"; $filecontent .= "<p>This email is to inform you that we are awaiting payment for your recent item.</p>\n"; $filecontent .= "<p>Amount to pay (including shipping): $$total</p>\n"; $filecontent .= "<p>First Last<br>\n"; $filecontent .= " Bank of New Zealand<br>\n"; $filecontent .= " xx-xxxx-xxxxxxx-xxx</p>\n"; $filecontent .= "<p>Reference #: $id<br>\n"; $filecontent .= " Failure to use this reference number may result in delays in shipping.</p>\n"; $filecontent .= "<p>Kind Regards,<br>\n"; $filecontent .= " First Last</p>\n"; $filecontent .= " </html>\n"; echo $filecontent; $fp = fopen("$id.msg", "a"); fwrite($fp, $filecontent); fclose($fp); PHP: