CodeIgniter Forums
Save email to MySQL - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Save email to MySQL (/showthread.php?tid=1481)



Save email to MySQL - wheel - 03-13-2015

Hi

I am beginner at CodeIgniter
What should be correct approach to save email to db,
to save attachments to disk
and to save links to these attachments?

I could not find any discussions.


RE: Save email to MySQL - comp_nerd26 - 03-13-2015

hi

do you mean save a contact form to database?

can you confirm what you are trying to do and i will try and help you?


RE: Save email to MySQL - wheel - 03-13-2015

(03-13-2015, 12:44 PM)comp_nerd26 Wrote: hi

do you mean save a contact form to database?

can you confirm what you are trying to do and i will try and help you?

Hi!!!

Thank you for reply.

The problem is complicated enough...

1. I need to save email letters to dbase (id, from_address, message_header, mail_content, attachment_url, upload_date)
and to save attachments to server disk.

2. Attachments should be saved to new directory every month. I.e:

/files/
2015.03/
2015.04/
....
2016.03/
....
....

3. And if attachment is a picture it should be resized.

I have found this topic: http://forum.codeigniter.com/thread-661.html?highlight=email
Just study it. It's not quite what i need. But it can help...


RE: Save email to MySQL - Rufnex - 03-13-2015

You need a Email parser like the following:

https://code.google.com/p/php-mime-mail-parser/
https://github.com/plancake/official-library-php-email-parser
https://github.com/eXorus/php-mime-mail-parser

Then you can extract the needed parts of an email and save it to your database, etc.


RE: Save email to MySQL - CroNiX - 03-13-2015

There are also the PHP imap functions which can help with all of this.