Solved

PHP based mail to news

Posted on 2002-04-03
4
198 Views
Last Modified: 2006-11-17
I would like to create a news area on a website. I would like the news to be written by a community of people. Is there a way I can have the news updated via email? Where the body of the email message becomes the news text? Then I would just have to give an email address to potential news contributors. I know http://www.k10k.net has done this via ASP, can it be done in PHP?
0
Comment
Question by:kaarsenmaker
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 6

Expert Comment

by:christopher sagayam
ID: 6916681
yes it can be done read more in

http://www.ii.com/internet/robots/procmail/
0
 

Author Comment

by:kaarsenmaker
ID: 6919756
is there a way to do this without using a special server tool, just through php?
0
 

Accepted Solution

by:
papygwen earned 200 total points
ID: 6922621
Hello Kaarsenmaker.
Here is how to process :

1. Your PHP script will have to be in a "cron" so as to run automatically each 10 minutes for instance
2. Create a dedicated mailbox aka news@mysite.com
3. make a readnews.php script in a protected folder using the IMAP functions. Even if in PHP it is called IMAP, it works fine with the POP3 mailboxes

Here is what it should look like :
Open the mailbox : $mbox = imap_open ("{localhost:110/pop3} INBOX", "user_id", "password");
How many emails ? $hmany = imap_num_msg($mbox);

Make a loop with $hmany with in it ("for" $i):
Get the body : $msg = imap_body($mbox, $i);
Insert it in your table : insert into mynews ($msg);
(Add the fields of your table : ID, date, etc...)
Mark the email as read : imap_delete ($mbox, $i);
End of your loop

Delete the marked messages : imap_expunge ($mbox);
Close the mailbox : imap_close ($mbox);

=> Be very carefull with the management of error messages which often occur !!!!!

May it help...





0
 

Author Comment

by:kaarsenmaker
ID: 6925490
thanx that has seemed to work. I ppreciate the efforts.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question