Tech4World

Latest News in Social Media & Technology

  • Home
  • Mobile
  • Hosting
  • Contact Us
You are here :Home Programming Send a Web Page to Email – PHP Script

Send a Web Page to Email – PHP Script

February 7, 2013 by Siddharth 7 Comments

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 = ‘me@tech4world.net’;
$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 🙂

No related posts.

Filed Under: Programming Tagged With: email, PHP

About Siddharth

Siddharth is a full time Internet marketer from India. He assists his clients from designing a website to drive sales through SEO, PPC & Social Media.

« Twitter Direct Message ( DM ) Bulk Deleter
Sites to track your Twitter Stats »

Comments

  1. Alexandre says

    November 15, 2010 at 5:52 PM

    Hi,

    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.

    Regards.

  2. Siddharth says

    November 15, 2010 at 9:14 PM

    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. 🙂

  3. nero says

    March 4, 2011 at 1:57 AM

    hmm, i wander how this script works? where to insert it?
    does it work with Aweber somehow?
    Thanks!

  4. Siddharth says

    March 5, 2011 at 2:11 AM

    Some Hosts prevent them. It just works on a simple Mail Function.

    Just put them on ur server and try it.

  5. viji says

    June 25, 2011 at 3:46 PM

    hi sid, this file_get_contents() itself get the whole page, really is it works fine?
    please tell me i want this immediately

  6. wilson mwiti says

    October 4, 2011 at 12:11 PM

    Fine ! Works perfectly Well..But the message sent is in form of code..Pls How do i convert it into a graphical webpage .

  7. Siddharth says

    October 6, 2011 at 2:28 AM

    Cool,

    just use HTML headers to make it graphical !

Leave a Reply

Your email address will not be published. Required fields are marked *

Subscribe to Tech4World RSSSubscribe to Tech4World FacebookFollow Tech4World on Twitter

Join Over 150,000+Fans & Followers

Recent Posts

  • How to Choose the Best VPS Hosting Provider
  • Understanding Cloud Computing: A Beginner’s Guide
  • How is the Cloud Different from the Internet
  • 5 DIY Tech Projects to Keep You Busy During Covid-19
  • The Efficiency of Robotic application in Agriculture
  • Web Software is Still Indispensable
  • 10 Useful Technology Trends For 2018
  • 5 Udemy Courses to Sharpen Your Online Business Ethics

Recent Comments

  • Ready Mailing Team on 5 DIY Tech Projects to Keep You Busy During Covid-19
  • Harriet J. Hartley on How is the Cloud Different from the Internet
  • Yogesh Shinde on How to Choose the Best VPS Hosting Provider
  • Raphael on How to Choose the Best VPS Hosting Provider
  • kidsbrooklyn on How to Choose the Best VPS Hosting Provider
  • shubham on How to Choose the Best VPS Hosting Provider
  • Digital Campus on How to Choose the Best VPS Hosting Provider
  • Sandiv on How to Choose the Best VPS Hosting Provider
  • CodeSquadz on Understanding Cloud Computing: A Beginner’s Guide
  • anjali on Understanding Cloud Computing: A Beginner’s Guide

Other Catagories

  • General
  • Google
  • Mobile
  • Programming
  • Tablets

Pages

  • About Us
  • Contact Us
  • Guest Posts & Product Reviews
  • Internet Marketing Services

Email Updates

[footer_backtotop text="Return to Top" href="#"]

Copyright © 2025 - Tech4World | design by WPStuffs