Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

PHP based mail to news

Posted on 2002-04-03
4
Medium Priority
?
206 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 600 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

916 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