EmailReader template - give your database email address
This little template allows you to read email from your POP3 or IMAP email account, parse those emails and store them in the database along with images, attachments etc. This template can be a part of your CRM, Helpdesk or web-based email client project. You can get this template for $30.
Screenshots and live demos
To see how it works send a test email to firstname.lastname@example.org and see it appear in the database. New emails are checked every five minutes. Make sure you are not sending anything confidential there.Enter live demo
- EmailReader template requires PHP 5.3 or better
- Supported databases are MySQL, SQL Server and Oracle
1. Enable imap extension in php.ini. If you are on a shared web hosting check with your hosting company support if this extension is enabled already.
2. Proceed to mail_settings table and modify path to store attachments. This can be either relative or absolute path. Make sure web server user has write permissions on that folder.
3. Proceed to email_servers table and add one or more pop3/imap servers. Interval between email checks is set in minutes.
4. Schedule a cron job to run getmail.php page every five or so minutes. If your website runs on Linux web server and you have access to crontab file you have two options here.
Method 1: Execute the script using php from the crontabTo execute cron.php every 5 minutes do the following:
Method 2: Run the php script using URL from the crontabThe URL to schedule is http://website/project/getmail.php. The following script executes the php script every 5 minutes by calling the URL using WGET. The -q option indicates quite mode. The "-O temp.txt" indicates that the output will be send to the temporary file.
If you are not sure how to schedule a cron job open a free account with monitoring service like Montastic and add http://website/project/getmail.php URL to be pinged once a day or or once an hour.
Frequently asked questions
Can I use EmailReader template with ASPRunnerPro?
While EmailReader template is only available for PHPRunner you can use a hybrid approach. PHP part will be reading emails from POP3/IMAP accounts and ASP part will be dealing with emails that are already in the database.
1. In PHPRunner create a new project using EmailReader template. Upload it to your website and configure mail settings. If everything setup properly new emails will be stored in mail_messages table.
2. Create a new project in ASPRunnerPro pointing it to the same database. Add mail_settings table to your project. This is it, you can see your emails in mail_messages table.
3. One more step if you need to display inline email images. Set 'View as' type of Body field to 'Custom' and use the following code there:
Can I change the default number of email messages EmailReader retrieves?
You can proceed to business\EmailReader\source folder in project directory and modify getmail.php file. Here is the line that defines the maximum number of messages to retrieve:
How do I verify EmailReader template setup?
In order to test EmailReader template setup send a test email to ope of incoming email addresses, wait for cron job to work (or open getmail.php manually in your browser) , then see new email message appear at the top of list.
- Send a test email to email@example.com
- Open http://xlinesoft.com/livedemo/emailreader/getmail.php in your web browser
- Then proceed to http://xlinesoft.com/livedemo/emailreader/mail_messages_list.php and see your email message there