CodeIgniter Forums

Full Version: Save email to MySQL
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.
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?
(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....ight=email
Just study it. It's not quite what i need. But it can help...
You need a Email parser like the following:

https://code.google.com/p/php-mime-mail-parser/
https://github.com/plancake/official-lib...ail-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.
There are also the PHP imap functions which can help with all of this.