Do you want to send all the contents of a webpage to your mail??
With this Code, You can send the contents of a Webpage to mail.
You can also set a cron job so that the particular page gets updated and is send to a particular mail which u set .
<? $to = ‘email@example.com’; $subject = ‘A test email!’; // To send HTML mail, the Content-type header must be set $headers = ‘MIME-Version: 1.0? . “\r\n”; $headers .= ‘Content-type: text/html; charset=iso-8859-1? . “\r\n”; // fetch Remotely $message = file_get_contents('http://example.com/filename.html'); // Mail it mail($to, $subject, $message, $headers); ?>
You may also send customized message as follows, just replace ” $message = ” with :
// fetch locally $message = file_get_contents('filename.html'); // Put your Text here $message = 'hello world';
Need any sort of help in modifying the code ?? Pls Drop your Comments, am here to help you 🙂
Thanks a lot for the tips.
I got here looking for the headers to send the email as HTML and, although it helped me, I had to change some characters.
In your declaration for the ‘headers’ variable you have some questions marks instead of single quotes.
Alexandre recently posted..The CSS 3 ‘Border Image’ Rule
yes, that’s true . it happens when i was taking backup. will correct it when i get time. thanks for noting. Glad that it helped you. 🙂
hmm, i wander how this script works? where to insert it?
does it work with Aweber somehow?
Some Hosts prevent them. It just works on a simple Mail Function.
Just put them on ur server and try it.
hi sid, this file_get_contents() itself get the whole page, really is it works fine?
please tell me i want this immediately
wilson mwiti says
Fine ! Works perfectly Well..But the message sent is in form of code..Pls How do i convert it into a graphical webpage .
just use HTML headers to make it graphical !