PHP Classes

This is excellent! I will add a few notes to help others use it.

Recommend this page to a friend!

      PHP Email To DB  >  All threads  >  This is excellent! I will add a few...  >  (Un) Subscribe thread alerts  
Subject:This is excellent! I will add a few...
Summary:Package rating comment
Messages:11
Author:Lil Peck
Date:2010-09-04 06:28:05
Update:2013-09-24 21:42:26
 

Lil Peck rated this package as follows:

Utility: Good
Consistency: Good
Examples: Insufficient
  1 - 10   11 - 11  

  1. This is excellent! I will add a few...   Reply   Report abuse  
Picture of Lil Peck Lil Peck - 2010-09-04 06:28:06
This is excellent! I will add a few notes to help others use it.

1. Make sure you are using the newest version from zip file etodb-2006-09-01.zip -- the main zip file named emailtodb_v0.9.pack.zip is NOT the newer version.
2. You need both the example_1_index.php (rename as your wish) file AND the class.emailtodb_v0.9.php file.
3. Configure line 35 for the folder you want files saved to and make sure that folder is writeable.
4. Configure line 48 according to whether you will run script from browser (it uses meta-refresh) or cron.
5. Configure line 59 for your mail server and login. For Windows Host that uses SMTP:
$this->link = imap_open("{mail.YOURDOMAIN.com:143/notls}INBOX", "YOUREMAIL@YOURDOMAIN.COM", "YOURPASSWORD");
6. Configure line 23 of example_1_index.php for database credentials and email credentials. If Windows with SMTP:
$edb->connect('MAIL.YOURDOMAIN.COM', '/smtp:143/notls', 'YOURMAIL@YOURDOMAIN.COM', 'YOURPASSWORD');

I tested this and it does a good job with archiving emails to database and saving the files. It does well even for saving multiple attachments. It will also give the attachment files sequential numbers to their filenames to avoid overwriting existing files.

I highly recommend this script. It took me a little while to figure out how to make it run on a Windows host, but once done, it does really well and is exactly what I needed. I had tried writing my own script that does this work, but this one is vastly superior.

  2. Re: This is excellent! I will add a few...   Reply   Report abuse  
Picture of Lil Peck Lil Peck - 2010-09-04 07:00:25 - In reply to message 1 from Lil Peck
One more thing, on line 327 or so, change
this line:
foreach ($from as $id => $object) {

to corrected as below:
foreach ($to as $id => $object) {

  3. Re: This is excellent! I will add a few...   Reply   Report abuse  
Picture of Lil Peck Lil Peck - 2010-09-04 07:39:28 - In reply to message 2 from Lil Peck
I read other comments for this script and saw that some reported that it won't save text file attachments. I tested that and it would not save text file attachments for me either. But, I don't have to have it do that. Still, that is something that I hope someone will post a solution for.

  4. Re: This is excellent! I will add a few...   Reply   Report abuse  
Picture of Lil Peck Lil Peck - 2010-09-04 08:16:26 - In reply to message 3 from Lil Peck
OK, I see that the script is set up to process only image attachments. If you take a look at the code, you'll see a Switch and only image attachments are provided for. If you want other filetypes saved, you'll have to write them into the code.

  5. Re: This is excellent! I will add a few...   Reply   Report abuse  
Picture of Stuart Stuart - 2010-11-16 03:27:00 - In reply to message 1 from Lil Peck
I just can not get this script to work. I've gone through and replaced the lines listed above but when I run the example_1.php it just comes up with a blank page :(

I've written my own script which is sort of working but struggles with the body as it includes emails replied to :(

  6. Re: This is excellent! I will add a few...   Reply   Report abuse  
Picture of Karl Karl - 2012-12-13 21:43:10 - In reply to message 1 from Lil Peck
My Experience with IMAP on Linux Server:

1. The script will not insert the message into the DB when you change line 327 from "foreach ($from as $id => $object") to: "foreach ($to as $id => $object)"

2. Keep Line 327 as "foreach ($from as $id => $object)" for IMAP.

  7. Re: This is excellent! I will add a few...   Reply   Report abuse  
Picture of Alan Crosthwaite Alan Crosthwaite - 2013-03-18 11:13:05 - In reply to message 1 from Lil Peck
Thanks for your help, I used your indications with some some slight modifications to the imap_open string on line 59 which gave me:

$this->link = imap_open("{mail.mysite.com:110/pop3/notls}INBOX", "myemail+mysite.com", "mypass");

In my case I had to add pop3 and it works perfectly.

However, in the class.emailtodb_v0.9.php example found in the zip, this string is meant to use the variables set at the beginning of the page:

var $host = 'mail.mysite.com';
var $port = '110';
var $login = 'myemail+mysite.com';
var $pass = 'mypass';

so I tried:

$this->link = imap_open("{"$host":"$port"/pop3/notls}INBOX, $login, $pass");

for imap_open but can't get this to work, any ideas why?

  8. Re: This is excellent! I will add a few...   Reply   Report abuse  
Picture of sidhesh prakash nalawade sidhesh prakash nalawade - 2013-08-17 12:07:47 - In reply to message 1 from Lil Peck
Works like charm....

But how to stop deleting mail from my inbox..i want that copy in my inbox tooo...

If i remove
imap_delete($this->link, $this->msgid);
imap_expunge($this->link);

  9. Re: Mail Deletion and extra finction...   Reply   Report abuse  
Picture of sidhesh prakash nalawade sidhesh prakash nalawade - 2013-08-19 07:24:09 - In reply to message 1 from Lil Peck
Is there anyway that mails should not get deleted and if some one replies a mail from my inbox then that replied message should also get appended in that database......

I know if i remove this 2 methods:
email_delete(); and email_expunge();

Then mails will not get deleted but the problem is blank values get inserted into the database!!!

Thanks in advance ....

  10. Re: This is excellent! I will add a few...   Reply   Report abuse  
Picture of sidhesh prakash nalawade sidhesh prakash nalawade - 2013-09-02 06:50:44 - In reply to message 9 from sidhesh prakash nalawade
thanks a lot for this awesome class..


My issues are solved now !!!!!!

 
  1 - 10   11 - 11