Welcome, Guest. Please login or register.
March 21, 2010, 12:16:51 PM

Login with username, password and session length
Search:     Advanced search
Interested in joining the WebsiteBaker team?
For more Information read here or on our new website.
110583 Posts in 15968 Topics by 9313 Members
Latest Member: Gudrun
* Home Help Search Login Register
+  WebsiteBaker Community Forum
|-+  English
| |-+  Modules (Moderators: Argos, BerndJM)
| | |-+  Mail2News Module
Pages: [1] 2 3 Go Down Print
Author Topic: Mail2News Module  (Read 20206 times)
rsmith

Offline Offline

Posts: 194


« on: May 24, 2006, 12:32:19 AM »

Per a forum post a couple weeks ago, I have developed a new module, and it's ready for additional testing and comments.
http://forum.websitebaker.org/index.php/topic,3248.msg20413.html#msg20413
Quote

For one of the website I am using I want to give the opportunity for someone to submit weblog postings (with the news module). The person does not has internet access at work, but wants to post an weblog item from work. Would it be possible to do the following with a cronjob:

    * Import the e-mails sent to a specific mailbox;
    * Read the content of the e-mail (possible with html layout)
    * Put the information into the news table



Mail2News Module Version 0.1rc1

Server/Host Requirements

  • PHP IMAP Support on the server
  • E-Mail Account that can be checked via POP3
  • News Section on your site to insert mail into

Features

  • Created to check mail and post "key'd" messages into a selected News Forum
  • Text or Basic HTML E-Mail Messages can be posted
  • Can check multiple E-Mail Accounts and post to multiple News Sections
  • Each configured E-Mail/News Setting can be marked inactive if needed
  • CRON/Task Scheduler Configurable so it can be done at predetermined intervals
  • "Psudo" CRON Configurable to only run when a page is views and the desired time between updates has passed (f e:only run once every xx minutes) (Mail2News Reader Section)

Future Possibilities

  • If desired by the Website Baker community.
  • Block/Accept Email Lists to limit who can Post
  • Admin "OK'd" messages (new messages marked inactive untill admin sets them to active)
  • Additional Cleanup and Documentation

If you would like to take a look and send a "test" message, please PM me and I will send you information to send and where to check the message, as well as additional information and screen shots.

There is a help.php that can be reached after install.... It gives basic info and instructions, with your help this can be improved upon.

I have done lots of testing, and still need to test as well as against different mail servers, and from different mail hosts...  as with any new module please test it on a test server before using it on a production server

I look forwared to any comments or wishes about this module...


Rob


edit: new version below
« Last Edit: August 18, 2006, 11:59:51 PM by rsmith » Logged
Woudloper
Guest
« Reply #1 on: May 24, 2006, 08:58:03 AM »

This is really a great module !!!  grin I like this very much, since I can use this for my own website!

This morning I tried to install the module finally into my testing environment, which still runs on WB2.6.1., but that shouldn't be a problem if I am not mistaken...

The installation went OK and I could access the settings within the admin console, but I had some small suggestions/problems:
  • After clicking the 'help' button I am sent to the frontend of the website and not to the help section. update: After succesfully setting up an account the 'help' button is working, so it only does not work when no e-mail information has been set up.
  • The dropdown for newssection is empty when no news module has been set up as a page and then it is not possible to save settings. Maybe you can add some check and mention that you need to create a newsmodule and not a mail2news page.
  • Maybe this text within the admin section is a bit unclear: Nieuws - emailaddress@domein.nl@mail.domein.nl as there is a @ sign twice in that line...
  • As mentioned above; should you be able to create a 'mail2news' page?
  • Update time is a bit unclear. Could this be explained a bit more in the 'help' section
  • Shouldn't the 'active' checkbox be checked by default?
  • The long and short section of the news contain HTML and within the HTML they also include the <HTML>, <HEAD>, <TITLE> tags where I only expect the body of the message...
  • As I limitted the limit of the short description to 80 only the HTML code is being displayed over there..

Suggestion:
  • Only allow updates from one or multiple specific e-mail addresses
  • Add some logging features so you could see if something is going wrong! Now you don't know if something is wrong in the configuration of the e-mail. According to my knowledgde everyting has been set correct, but I don't receive e-mail
  • Would it also be possible to create news items into a specific 'category'?
  • Would it be possible to make the HTML lowercase so they are HTML 4.01. compliant...

Test result
After finally getting everything correct and setting up the pseudo cron jobs the message from microsoft outlook has been submitted as a news post!!!
« Last Edit: May 24, 2006, 09:05:38 AM by Woudloper » Logged
rsmith

Offline Offline

Posts: 194


« Reply #2 on: May 24, 2006, 12:38:39 PM »

Glad it works... smiley
I'll start working on your suggestions, this is exactly what I need to make it better... developing the module I understand whats what. so your feedback is perfect for helping me see what others see.
I should have the next RC available in the next few days.... hopefuly I can correct some of the issues Smiley..



Thanks for the feedback

Rob
Logged
valerie

Offline Offline

Posts: 156


WWW
« Reply #3 on: May 26, 2006, 06:56:34 AM »

You could also check out this plugin for wordpress (called Postie) that adds a lot of features to the basic wordpress functionality: http://www.economysizegeek.com/wp-mail/

I've used it for awhile and I like that it can accept pictures and attachments (you said yours does basic html, so I thought that didn't include attachments and pics). Anyway, if you're looking to add to the features at any point, maybe this one could give you some ideas or a place to start. It seems really complicated, though, but maybe that's just because I don't know any programming.
Logged

http://www.robcomm.net
--editing and proofreading for American English
--print and web publication management
--graphic and web design, including original photography
YeShakka

Offline Offline

Posts: 146



« Reply #4 on: May 27, 2006, 01:16:34 AM »

I've used it for awhile and I like that it can accept pictures and attachments (you said yours does basic html, so I thought that didn't include attachments and pics).
As you may remeber from the other thread I posted a piece of software which alrady has this feature (attchments) and is very flat designed.
Take a look at:
http://forum.websitebaker.org/index.php/topic,3248.msg20544.html#msg20544
Logged
valerie

Offline Offline

Posts: 156


WWW
« Reply #5 on: May 27, 2006, 02:34:00 AM »

I saw that you posted the other software. I thought you were just telling the developer about it so he can analyze the code. I couldn't tell from the thread if the mail2news module itself includes this feature or if it is even planned for inclusion in the mail2news module.  Anyway, I'm curious--does mail2news put the pictures in the message or just include them as attachments? what about simsi--how does it handle pictures?
Logged

http://www.robcomm.net
--editing and proofreading for American English
--print and web publication management
--graphic and web design, including original photography
rsmith

Offline Offline

Posts: 194


« Reply #6 on: May 27, 2006, 02:47:26 AM »

Hi
Currently the Mail2News module does not handle images...  seems to handle most html code... and html files that have been attached to a text email

File attachments could be a possiblility in the future.

I hopefully will have the next RC available this weekend, with the suggestions posted by Woudloper,and some of my other ideas
Time permitting I may start looking at file attachements.. in the case of images, jpg, png, gif etc these could be displayed within the message and links to other file types zip, pdf, etc...

I have a site im using for my Notes and Change Log for this module and others
http://slink2.no-ip.info:82/wsb/pages/wb-ideas/modules-mods/mail-to-news-module.php
Once done I will post the new RC here in the forum

I have Downloaded and will take a look at the simsi code.... I have not yet got it to work... in my case i think its the "from" address not sure how this needs to be formated. and havent yet found any documentation.


Rob
 
Logged
vegasgeek

Offline Offline

Posts: 1


« Reply #7 on: August 18, 2006, 09:23:33 PM »

I was able to get the module up and running smoothly and really like being able to use different keywords in the subject of the email to post to a different news page.

I have run in to an error that I believe has to do with the use of an apostrophe. When I send a post via email that contains an apostrophe, the email gets checked and deleted from the system, but, it never gets posted.

Has anybody else seen this behavior?
Logged
rsmith

Offline Offline

Posts: 194


« Reply #8 on: August 18, 2006, 11:56:30 PM »

Hi
I've been a bit slow to continue developing this module but Smiley here is a fix for the single quote issue... as well as a few other small fixes...

Rob

Change log
    * Fixed a single quote issue within the body of the email
    * Removed HTML Tags From Short Body
    * Active Checkbox by default
    * Clean up html code, all lowercase
    * Check for existing News Sections, if none exist display a message "No News Sections Found"
    * Layout the Admin List of accounts differently so its more easily read. ie Account   - Server   - Subkey
    * Update Help - Better Description/Info about the Update Time
    * Correct Help button, v0.1rc1only works when an account is setup
    * News section list with the groups so can be configured to post to different groups within the same news section - News sections listed and then news-groups
    * update install.php -
    * create update.php for new group_id fields



EDIT: New Version Below
« Last Edit: September 14, 2006, 12:43:10 AM by rsmith » Logged
mathetos

Offline Offline

Posts: 87


i bake and shake... shake 'n bake WB


WWW
« Reply #9 on: August 26, 2006, 07:28:44 PM »

It seems that the new "check for news sections" operation is working too strictly. I can not get past the "You need to have a News Section installed on a page before you can configure the Mail2News Module." error no matter what I do. I have uninstalled and re-installed that module many many times. I have reloaded all modules many times. I have put the Mail2News reader on root pages and child pages, I have also kept it totally out. I have installed News sections on root pages and child pages. I believe I have tried every combination unsucessfully now.

Any suggestions? I would love to get this working.
Logged

___________________ ___________________ _
www.autotheography. com
Your Journey ~ His Story
rsmith

Offline Offline

Posts: 194


« Reply #10 on: August 26, 2006, 07:36:03 PM »

Hi mathetos.
Odd.... Ill do some checking and setup a clean WB install and see if i can reproduce your results...

Rob


EDIT:
The problem can be resolved simply by creating a "group" within your news section.. (worked on mine)...
I will tweak and test the sql statement before posting another version...

Rob
« Last Edit: August 26, 2006, 08:09:56 PM by rsmith » Logged
mathetos

Offline Offline

Posts: 87


i bake and shake... shake 'n bake WB


WWW
« Reply #11 on: August 26, 2006, 08:22:54 PM »

I also did a bit more experimenting:

1) I started using the .zip from your site instead of the attachment above. I'm not sure if that's significant or not.

2) When I install the module, there are two items in the module drop-down list. Mail2News and Mail2News Reader. If I go to settings and "re-load modules" the Mail2News Reader disappears.

3) I also made a group (on both the root news page and the child root page) and still no success.

Linux server, MySql database... happy hunting
Logged

___________________ ___________________ _
www.autotheography. com
Your Journey ~ His Story
rsmith

Offline Offline

Posts: 194


« Reply #12 on: August 26, 2006, 08:28:21 PM »

Hi

1,The zip on my site and the one in the post above should be the same

2,I saw this too with the reload modules, I'll have to look into this further. Probably have to make the Mail2News Module, and Mail2News Reader 2 different modules to get it to stick.

3, is there any posts in the news section?... even an inactive one?...

Rob
Logged
mathetos

Offline Offline

Posts: 87


i bake and shake... shake 'n bake WB


WWW
« Reply #13 on: August 30, 2006, 02:37:07 PM »

Rob, thanks again for a GREAT module and for all of your help you offered in getting my server in line to work with this module. It's all running really great.

I thought I would update the forum here so others could see what you and I discussed and I would make my suggestions here as well.

UPDATE FOR ABOVE PROBLEMS
The errors I reported above were fixed by making sure that EACH OF THE FOLLOWING were properly installed:
  • a news section
  • with a news group
  • with at least one post (active or inactive, didn't matter)
After that all was well.

BUG
Just one, if you ever "Reload Modules" from the Administrative Settings, the Mail2News Reader is erased from the Modules List (unless it is installed on a page). You mentioned this above. Just wanted to re-affirm it.

SUGGESTIONS
1) This is a compliment with a suggestion that goes beyond the Mail2News module. I really like how the Mail2News module works directly with the News module. That way all presentation related things can be handled through the News settings. That said, I installed rabsaul's CSS mod to news module from here: http://forum.websitebaker.org/index.php/topic,3897.0.html in order to make the presenation completely CSS driven. I would just suggest this for everyone who utilizes the News and/or Mail2News modules.

2) Now a real suggestion: When I use the "short desc. length" the text that appears first of all in the short description is (again) the subject of the email, INCLUDING the subject key. That's a serious security issue!

3) It would be nice to have the option of being able to delete the message from the respective email inbox or not. As it is now it is automatically deleted. I'd just like the choice (and potentially a back-up).

4)  It seems that after the new account is saved the news section field is then hard-coded in. I would like to be able to later change which news group the emails are filtered into, if needed.

5) Lastly --and I have no idea how this would affect things-- wouldn't it be far simpler to have the email settings (which are now in the Administration Settings) be held within the page settings of the respective page? As it is now it takes several clicks to get to the Administration Settings and then the specific email settings for each email. It would just save a lot of clicks and page refreshes in each initial set-up.

That's it! I'm excited to see how this thing evolves!

Thanks,
~mathetos~
Logged

___________________ ___________________ _
www.autotheography. com
Your Journey ~ His Story
rsmith

Offline Offline

Posts: 194


« Reply #14 on: August 30, 2006, 02:49:32 PM »

Glad we got it going for you...

I do have  a list of changes I want to make sometime..... and i'll include your ideas

Per your comments
2, I'll have to look at this, mine doens't do this... 
3, I'll look at this too, will need some way to id the message as read or else it gets posted again and again each time the mail is checked
4, I'll look at this too, I thought it was Smiley but will check again
5, Ill think about this,  currently all news groups would be updated when any of the pages that has the "reader" portion installed.  giving a central location to manage them all... if at the page level it could produce more hits to the mail server as opposed to a single hit reading all the mail. and ill get the reload addon corrected too....



keep the ideas coming.. thats the only way to make WB better

Rob
Logged
mathetos

Offline Offline

Posts: 87


i bake and shake... shake 'n bake WB


WWW
« Reply #15 on: September 01, 2006, 08:08:18 PM »

Rob,
If you want to see how the subject key gets included please visit my (in development) site:
http://dz4.dailyrazor.com/~mathetos/wb/

Also, suddenly, their are tons of "=0D" , "=A0" and such throughout my messages.

I'm using a relatively unknown web-based email provider so that might cause some problems. I wasn't able to get my gmail account to work correctly (any suggestions?).

BTW... any progress on an update?

Thanks again!
~mathetos~
Logged

___________________ ___________________ _
www.autotheography. com
Your Journey ~ His Story
rsmith

Offline Offline

Posts: 194


« Reply #16 on: September 01, 2006, 08:22:13 PM »

HI
I'll take a look a the =0d and =a0.... these seem to be line returns...(was with gmail anyway)
ill check the key too.. not sure why yours would be showing but ill do some more testing to see if I can duplicate it...

I'll attempt to get some time on the updates this weekend.. its been a crazy week...

Rob
Logged
digitalbackups

Offline Offline

Posts: 25


« Reply #17 on: September 07, 2006, 08:04:01 AM »

Any idea why I might be getting this error on the display page for the news.

Fatal error: Call to undefined function: imap_open() in d:\domains\afcpconference.org\wwwroot\modules\mail2news\mailread.php on line 68


Thanks,

Digital Backups
Logged
rsmith

Offline Offline

Posts: 194


« Reply #18 on: September 07, 2006, 12:02:22 PM »

Hi.
Yes Smiley and the next version will include tests to check for the required functions.

You need to install php4-imap or php5-imap depending on the version of PHP you are running...
on linux this can be done with the softeware update utilities... just search and add the needed php rpm.

on windows you need to make sure the file exists and then edit your php.ini to include the line extension=php_imap.dll
in most cases the line exists and is jsut commented out.

Hope this helps..
Rob
Logged
digitalbackups

Offline Offline

Posts: 25


« Reply #19 on: September 07, 2006, 10:01:58 PM »

Rob,

Un-commenting the php_imap.dll  in php.ini worked like a charm, Thanks,

Thank you for the great work on the module, it works awesome ! !

One question (Greedy ain't I)  I have the posts displayinig on a news page,  but is there a way if I wanted to on a side bar to display just the last "3" titles can you point me in the right direction for this newbie PHP scripter.

Many Thanks,

Digital Backups
Logged
kweitzel
Forum administrator
*****
Offline Offline

Posts: 5561


WWW
« Reply #20 on: September 07, 2006, 10:24:29 PM »

look for the existing scripts "Code Snippet: Display news items, anywhere" and " News module: 2 headlines (with readmore) and the rest as a list (possible?)" they are perfect for this ... i did also include them in my template "Lava". If you need implementation hints just take a look ...

cheers

Klaus
Logged

http://www.weitzel.biz
PM has been disabled
digitalbackups

Offline Offline

Posts: 25


« Reply #21 on: September 08, 2006, 12:21:46 AM »

Klaus,

I read the links, and got the latest post to post in the sidebar, but having trouble getting the last (3) posts to display - (For those trying this I had to create a news page and I hid it, to go along with my mail2news page) - I am only getting the the very latest one to post.

This is the code I used in the sidebar,

Code:
<?php

// Specify the Group(id) you want to read the news from or 0 for all groups
  $group "AFCP-News";

// Specify number of newsitems
  $limit="3";

// Specify read more text
 
$readmore "Read more";

// Specify Older news text
 
$oldernews "Older news";

// Query for obtaining stuff from a group
 
$query "SELECT * FROM ".TABLE_PREFIX."mod_news_posts WHERE group_id = $group and active = 1 ORDER BY position DESC LIMIT 0, 10;";

// Query for all groups ;)
 
if ($group<) {
 
$query "SELECT * FROM ".TABLE_PREFIX."mod_news_posts WHERE active = 1 ORDER BY position DESC LIMIT 0, 10;";
}

// No changes needed here, maybe for output!

global $database;

$result $database->query($query);
$total $result->numRows();       // how many items are there?
if ($total>1) {                                // at least 2 needed for 2 news items
$data $result->fetchRow() ;    // get left item
echo '<table width=100%>';
echo 
'<tr><td width=100%><font color="#FFFFFF">'.$data['title'].'</font> <a href="'.WB_URL.PAGES_DIRECTORY.$data['link'].PAGE_EXTENSION.'">'.$readmore.'</a><br><br></td></tr>';
echo 
'</table>';
}
?>

Any suggestions,

Thanks,   Digital Backups
« Last Edit: September 08, 2006, 07:02:39 AM by digitalbackups » Logged
mathetos

Offline Offline

Posts: 87


i bake and shake... shake 'n bake WB


WWW
« Reply #22 on: September 08, 2006, 08:20:30 AM »

Quote
This is the code I used in the sidebar
Code:
// No changes needed here, maybe for output!

global $database;

$result = $database->query($query);
$total = $result->numRows();       // how many items are there?
if ($total>1) {                                // at least 2 needed for 2 news items
$data = $result->fetchRow() ;    // get left item
echo '<table width=100%>';
echo '<tr><td width=100%><font color="#FFFFFF">'.$data['title'].'</font> <a href="'.WB_URL.PAGES_DIRECTORY.$data['link'].PAGE_EXTENSION.'">'.$readmore.'</a><br><br></td></tr>';
echo '</table>';
}
?>

You need a new data field for each post you want there (the code isn't a loop). Just add two more echos under your first td, like this:

Code:
echo '<tr><td width=100%><font color="#FFFFFF">'.$data2['title'].'</font> <a href="'.WB_URL.PAGES_DIRECTORY.$data2['link'].PAGE_EXTENSION.'">'.$readmore.'</a><br><br></td></tr>';
echo '<tr><td width=100%><font color="#FFFFFF">'.$data3['title'].'</font> <a href="'.WB_URL.PAGES_DIRECTORY.$data3['link'].PAGE_EXTENSION.'">'.$readmore.'</a><br><br></td></tr>';

make sure (like above) that you have data2, data3, etc for each new respective data field.
~mathetos~
Logged

___________________ ___________________ _
www.autotheography. com
Your Journey ~ His Story
kweitzel
Forum administrator
*****
Offline Offline

Posts: 5561


WWW
« Reply #23 on: September 08, 2006, 08:25:02 AM »

you need to clone this line into $data2 and $data3 ... because otherwise there is nothing to output.

Code:
$data = $result->fetchRow() ;    // get left item
$data2 = $result->fetchRow() ;
$data3 = $result->fetchRow() ;

and then the output as well ....

Another Hint, table of the width 100% can break layouts in IE, so for tables you should choose something less (like 98%).

cheers

Klaus
Logged

http://www.weitzel.biz
PM has been disabled
mathetos

Offline Offline

Posts: 87


i bake and shake... shake 'n bake WB


WWW
« Reply #24 on: September 08, 2006, 09:21:37 AM »

I had that nagging feeling that I forgot something...

Thanks Klaus, without you, Matthias, and Rob Smith, I'd be lost!

~mathetos~
Logged

___________________ ___________________ _
www.autotheography. com
Your Journey ~ His Story
Pages: [1] 2 3 Go Up Print 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!