In Progress

Script to write email Attachment to Filesystem (m2fs)

PHP script that runs on any linux system that does the following.

- Checks a certain email address (pop and/or imap ok, but it must work with gmail accounts, see google help pages on ports and ssl connections)

- Gets the email, strips the attachments out of it, and saves them to

a directory on the server

- File extensions that are allowed as an attachment can be configured in the script. Other extensions are ignored.

- In the script, a root directory, and a directory in that root directory for attachments to be saved is specified in a configuration file, and the sub-directory will be specified in the subject of the mail.

Example, if the attachments directory is configured as "/home/me/m2fs/attachments" and someone sends a mail to the specified email address with an attachment, and the Subject of the mail is "mystuff-docs", then the attachment would be stripped and placed in the /home/me/attachments/mystuff/docs/ directory.

- If the directory that is specified in the Subject of the mail doesnt exist, it should be created, with any other directories in the path specified in the Subject (the whole path should be created if it doesnt exist.

- The body of the mail should be stored in another fixed (configured) directory, with the timestamp of the mail.

- If the mail subject has spaces or any special characters other than - or _ in it, then those characters should be replaced with "_".

- A log of any errors should be stored in another directory under the root dir that is also configured in the config file.

Additional specifications:

- zip files should be extracted (not left as zip files) and the contents of the zip file should be saved with their original file names in the directory that is specified in the subject of the email. There is no need to create another directory for the zip file content, just treat those contents as if they were attached to the email unzipped.

- If a file of the same name exists already in the same directory that is specified, then a "_n" (where n is a number starting at one) should be added to the new file before the extension. Eg: if [url removed, login to view] exists, and [url removed, login to view] is sent by email to the same directory, then it should be renamed [url removed, login to view] and saved. If it is sent yet again after that, it should become [url removed, login to view] and so on.

- Each saved email (body file, text without attachments) will be saved.

- The file body (text file) however should be saved in another directory, with the timestamp as the file name e.g. [url removed, login to view] (timestamp until second). The full text should remain in the body file, but not the attachment content. The attachment names however should remain in the content, as this will facilitate searching who sent which attachment later on.

Preferable, this solution should be standalone (not need any other files other than standard PHP libs or perl libs, but if that is impossible, procmail and fetchmail may be used for mail fetching and processing.

Best is a php script that can be run from php-cli by cron. Otherwise a perl script that can be run by cron is ok. Anyone who proposes php will be chosen over people who chose perl.

Skills: Perl, PHP

See more: email attachments file system, write email attachment, email attachment file system, perl mail script attachment, perl email attachment php, m2fs extension, m2fs file name, write the contents, write names, Write from home, write an e mail, where to write content, perl script to zip files, help to write for me, google docs mail, facilitate it, checks in the mail, best path, address write, php write attachments, perl script email attachment, script email contents directory, m2fs, mail script php attachment, perl mail zip

About the Employer:
( 0 reviews ) Warsaw, Poland

Project ID: #580744

12 freelancers are bidding on average $166 for this job

gangabass

I can do this job for you. See PM for details.

$100 USD in 3 days
(202 Reviews)
6.3
wildlily980

I can do this with php for you.

$210 USD in 8 days
(40 Reviews)
6.0
web2apps

I can do it for IMAP/Gmail. I've done similar script before (see my review). Escrow required to start the project.

$75 USD in 3 days
(23 Reviews)
4.8
arename

Dear Sir, I can provide what you need, please read PMB

$200 USD in 5 days
(9 Reviews)
4.7
SeniorPerlDev

i'm interested. but i prefer Perl rather than php.

$180 USD in 5 days
(10 Reviews)
4.3
JesseLin

I can write a standalone php script for this job.

$200 USD in 3 days
(13 Reviews)
4.0
mfranco

Please see PMB.

$40 USD in 0 days
(12 Reviews)
3.3
smartyDeveloper

Dear Project Owner, I can create this script, all in php+shell scripting. on further communication if you like, i will send you a development plan about steps and time required. Thank you

$400 USD in 15 days
(0 Reviews)
0.0
kkhanal

lets do it... check pm for details

$80 USD in 5 days
(0 Reviews)
0.0
winsetter

Hi, I'm ready to finish the job for you. See my profile to assure you.

$250 USD in 5 days
(0 Reviews)
0.0
Shawnvettori

Hi, I can do this for [url removed, login to view] start this right [url removed, login to view]

$75 USD in 3 days
(0 Reviews)
0.0
JunhuiCHEN

Dear maltokyo Please let me do it for you! I promise you highest quality, on time delivery, and 2 years of free maintenance. Thank you! [url removed, login to view] [url removed, login to view] http://S More

$180 USD in 3 days
(0 Reviews)
4.1