Can I make a script to post emails to a forum? [nvm]
Hi guys, I've got a question and I figured that the people here are most likely to have an answer to this question.
I'm admin of a website for our high school's robotics club, and we've been trying to redesign our site for next year's competition because the site is part of the ranking. One thing I was working on adding was a properly updated RSS feed, because our president isn't going to update the RSS feed by hand when she posts a new message to the (google groups) mailing list.
Now, using Simple Machines Forum's SSI (server side includes) I made a php script that generates an RSS feed from the topics in a certain board (I think they had a tutorial on how to do it so it wasn't hard). However, the president never posts announcements on the forums in the announcements board that I set up for that purpose. I don't blame her because no one really checks the forum anyway.
I was wondering if it is possible to write a script on the server (perhaps set up to run as a cron job) that checks the email of a certain account which only gets email from the mailing list, and then posts a message to the forum in the appropriate board. I think the main difficulty for me would be checking the email account, as I don't know if you can do this in php. I'm willing to learn perl or whatever it takes if I have to. The site is hosted on bluehost. Thanks for the help!
Edit: A quick google search turns up php IMAP functions as a way to check email through PHP, although I am not certain whether my host has that enabled. In the cpanel there is an option for installing PHP PEAR packages, might this allow me to install IMAP support if it doesn't already exist?
Edit again: I found that there is a package http://pear.php.net/package/Mail_IMAPv2 available for installation on my server. Probably will be able to figure out how to use it to do what I want, but if anyone has any experience with this then feel free to chime in.
I am not very fond of this complicated constructs in PHP. What I usually do is to write some Bash script which uses simple and proven tools to carry out a task.
You say you are not sure about IMAP. Well, then use a Bash tool to check for mail using the POP protocol (fetchmail, procmail, telnet). Lat Bash do whatever you need to do and test it in Bash. Once everything works, use the exec call from PHP.
Just make sure that everything you write or access can be accessed from PHP which uses most likely the www-data credentials.
Hmm, thanks for the ideas. I've decided on a simpler, less automated method because now I'm not sure whether you can post from a script. I'll just add a dummy email account to the mailing list that always auto-replies "Make sure you post the news in the forum as well." Simple, and effective. Thanks for the help anyway.
|All times are GMT -5. The time now is 03:32 PM.|