Tech4World

Latest News in Social Media & Technology

  • Home
  • Twitter
  • Facebook
  • Android
  • iPhone
  • iPad
  • SEO
  • Design
  • Hosting
  • Blogging
You are here :Home Programming Send a Web Page to Email – PHP Script

Send a Web Page to Email – PHP Script

February 21, 2010 by Siddharth 7 Comments

share

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 R 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.
    Alexandre recently posted..The CSS 3 ‘Border Image’ Rule

  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 *

CommentLuv badgeShow more posts

Subscribe to Tech4World RSSSubscribe to Tech4World FacebookFollow Tech4World on Twitter

Join Over 150,000+Fans & Followers

Recent Posts

  • 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
  • Why Windows Update Is Always an Issue and How to Fix It

Recent Comments

  • REKHA on 5 Misconceptions About PDF Files
  • Kuzey on How to Recover Data from Android Phone and Tablet
  • kuldeep singh on 5 Misconceptions About PDF Files
  • Cinematographer in jaipur on How can Spy Apps become both a Protector and Destroyer? The pros and cons of mobile spy apps
  • George Caputo on Top Most Irritating Windows 10 Issues And How To Fix Them
  • ANAND on 5 Misconceptions About PDF Files
  • Steve on How to Transfer WhatsApp Messages from iPhone to Android
  • Ashcraft on Bitdefender Mobile Security Review
  • ankush wadne on MacX DVD Ripper Pro -Speedy Alternative to Handbrake to Rip DVD at Fast Speed [Giveaway]
  • Richarlison on Top Most Irritating Windows 10 Issues And How To Fix Them

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 © 2022 - Tech4World | design by WPStuffs