Jump to content

E-Mail Attachments


skitchen

Recommended Posts

Hello!

 

Well, I hope to get an answer to this from somebody here. I've been trying to find something about how to do this all day but haven't had any luck as yet.

 

I'm trying to find a way to get a PHP script to pick up an attachment from an e-mail that is sent. For example...

 

User sends e-mail with attachment to [email protected] which is directed to www.domain.com/script.php

 

So, the e-mail is being handled by script.php. I then need this to look at the e-mail as a whole including the e-mail address its been sent to but more importantly to pick up the attachment and place it in a folder on the server.

 

Hard to explain but I hope that's easy to understand.

 

Please, can anybody help with it or have any suggestions?

 

Thank you!

Steve

Link to comment
https://forums.phpfreaks.com/topic/46623-e-mail-attachments/
Share on other sites

I don't know if you can "direct" an email to a PHP script, but you can have PHP to handle the emails sent to a certain address, although I believe this is very low level and you might have to do a lot of work...

 

Look at the PHP IMAP functions as they might serve your purpose

http://www.php.net/imap

Link to comment
https://forums.phpfreaks.com/topic/46623-e-mail-attachments/#findComment-227023
Share on other sites

I'll give you the exact details of what I am trying to do here.....

 

The actual script I've written is an admin management program for an admin customer based department. It will send documents, keep track of events, allocate references, perform searches, produce reports, manage users etc. Now, anything sent out by the system is obviously easy to keep a track of but things that come IN from customers is currently kept in PAPER format. As an addition to the existing script I am trying to get the documentation stored electronically to cut out the paper work and storage etc.

 

We have the facility to scan this incoming documentation and send it automatically to an e-mail address but rather than having it sent to an actual physical e-mail address, I want it to be sent to [email protected] where reference is replaced with the actual allocated reference number - ie: 135641 for example so the e-mail it gets sent to would be [email protected]. The attachment from the scanner is then uploaded to the system under that reference number. This therefore automates the process and doesn't require anybody to physically upload the files

 

Now, I have the e-mail part sorted and it directs to the script. Also, the part of the script to do this bit is half done in that whatever is in the BODY and SUBJECT of the e-mail is copied and stored to the MySQL database. So, Im half way there. The only problem I'm having is that I don't know how to handle the actual attachment or how to get the script to read it and do something with it ... as in move it to the server.

 

Everything is in place to do and it will do what I want with text but I just cant get the file part sorted out.

 

I know it's a tricky one so any help much appreciated.

Link to comment
https://forums.phpfreaks.com/topic/46623-e-mail-attachments/#findComment-227092
Share on other sites

I Can tell you the algorithm for that but you have to make the script by your self

---------------------------------------------

So what your Question is??

what you need is to get the email from a POP account (If you have pop3 access to the mail accounts) then read the email as well as Attachment(s)

Is that your Question ??

Do you have pop3 access ??

Link to comment
https://forums.phpfreaks.com/topic/46623-e-mail-attachments/#findComment-227595
Share on other sites

Hi

 

No, it doesn't actually go to a pop3 account. It simply gets routed to the script and cuts out any mailbox etc.

 

As I say, I've got it to read the subject and body and save it in a MySQL database but I cant get it to do anything with the attachment.

 

Cheers

Steve

Link to comment
https://forums.phpfreaks.com/topic/46623-e-mail-attachments/#findComment-227897
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.