Reply to Re: how to send web page to email using php

Your name:

Reply:


Posted by Christoph Burschka on 11/20/06 16:44

linda wrote:
> "dang" <raevian@yahoo.com> wrote in message
> news:1163721122.974722.49050@e3g2000cwe.googlegroups.com...
>> Hi I am new in php coding and I want to ask for your help.
>> My question is how am i going to send my web page to email using
>> php?Could anybody give me sample code? Your quick response is highly
>> appreciated. Thanks!
>>
>
> What do you mean your webpage? Do you mean a link!
>
> Best wishes,
> Linda
>
>


If you mean a link, I'm assuming the question is how you send email using PHP.
The function is:

mail($recipient,$subject,$message_text,$additional_headers);

Where additional headers could (for example) be "From: Sender
<sender@mail.net>", which would ensure that the mail has you as a sender instead
of the server default.

----

If you are actually trying to send a web page, then I'd use something like this:

$url ="http://yourpage.com";
$from ="Your Name <your@email.com>";
$to ="Recipient Name <recipient@email.com>";

$page = file_get_contents($url);
preg_match('/<title>(.*)<\/title>/',$page,$title); // get title of web page
$subject = "Web Page: ".str_replace("\n","",trim($title[1])); // use as subject
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: '.$from;

mail($to,$subject,$page,$headers);

----

The important part is the content-type. Without setting this, you cannot send an
HTML message.

--
Christoph Burschka

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация