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
Solved

PHP based mail to news

Posted on 2002-04-03
4
195 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
  • 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
This article discusses four methods for overlaying images in a container on a web page
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

856 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