File attachment process

View: New views
3 Messages — Rating Filter:   Alert me  

File attachment process

by pantera975 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have been working on a project for work where I'm changing the file attachment process in squirrelmail. I've got most of it worked out but I'm stuck in a certain area. I'll try to explain it clearly.

User1: Writes an e-mail and adds an attachment. By doing this the file is put /var/spool/squirrelmail/attach/ and named by GenerateRandomString(32, '', 7). He has not sent yet so at this point /var/spool/squirrelmail/attach/ contains 1 file (3543eknohgsogjfdnsdfh)

User2: Writes an e-mail and adds an attachment. Their attachment does the same thing but with a different random string. Now /var/spool/squirrelmail/attach/ has 2 files. (3543eknohgsogjfdnsdfh and aklfas5435jn6as)

User1: Clicks send and somehow squirrelmail knows to only get 3543eknohgsogjfdnsdfh and not the other. How is this done? What part of the code tells it what files names to look for in /var/spool/squirrelmail/attach/ during the send process.

Re: File attachment process

by Jon Angliss :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, 9 Jul 2009 09:55:43 -0700 (PDT), pantera975
<pantera975@...> wrote:

>
>I have been working on a project for work where I'm changing the file
>attachment process in squirrelmail. I've got most of it worked out but I'm
>stuck in a certain area. I'll try to explain it clearly.

What changes are you making?

>User1: Writes an e-mail and adds an attachment. By doing this the file is
>put /var/spool/squirrelmail/attach/ and named by GenerateRandomString(32,
>'', 7). He has not sent yet so at this point /var/spool/squirrelmail/attach/
>contains 1 file (3543eknohgsogjfdnsdfh)
>
>User2: Writes an e-mail and adds an attachment. Their attachment does the
>same thing but with a different random string. Now
>/var/spool/squirrelmail/attach/ has 2 files. (3543eknohgsogjfdnsdfh and
>aklfas5435jn6as)
>
>User1: Clicks send and somehow squirrelmail knows to only get
>3543eknohgsogjfdnsdfh and not the other. How is this done? What part of the
>code tells it what files names to look for in
>/var/spool/squirrelmail/attach/ during the send process.

When the attach code is ran, the file is uploaded, and dropped into
the $attach_dir folder (saveAttachedFiles() in src/compose.php).  The
temporary name, and actual file name are stored in the Message object
(see line 1399 of src/compose.php and line 1089 of
class/mime/Message.class.php).  This is then serialized, and added to
the compose form.  See the hidden form item attachments around line
1277 in src/compose.php.

When the message is finally ready for sending, the delivery class is
called (class/deliver/Deliver_SMTP.class.php), where writeBody is
executed, which walks through all the attachments, and writes them to
the necessary stream (smtp/sendmail).

That help?

--
Jonathan Angliss
<jon@...>


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
-----
squirrelmail-devel mailing list
Posting guidelines: http://squirrelmail.org/postingguidelines
List address: squirrelmail-devel@...
List archives: http://news.gmane.org/gmane.mail.squirrelmail.devel
List info (subscribe/unsubscribe/change options): https://lists.sourceforge.net/lists/listinfo/squirrelmail-devel

Re: File attachment process

by pantera975 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Wow! Thank you so much! You have answered so many of my questions! Is there any way I can add points to you or up your score some how?


Jonathan Angliss-2 wrote:
On Thu, 9 Jul 2009 09:55:43 -0700 (PDT), pantera975
<pantera975@hotmail.com> wrote:

>
>I have been working on a project for work where I'm changing the file
>attachment process in squirrelmail. I've got most of it worked out but I'm
>stuck in a certain area. I'll try to explain it clearly.

What changes are you making?

>User1: Writes an e-mail and adds an attachment. By doing this the file is
>put /var/spool/squirrelmail/attach/ and named by GenerateRandomString(32,
>'', 7). He has not sent yet so at this point /var/spool/squirrelmail/attach/
>contains 1 file (3543eknohgsogjfdnsdfh)
>
>User2: Writes an e-mail and adds an attachment. Their attachment does the
>same thing but with a different random string. Now
>/var/spool/squirrelmail/attach/ has 2 files. (3543eknohgsogjfdnsdfh and
>aklfas5435jn6as)
>
>User1: Clicks send and somehow squirrelmail knows to only get
>3543eknohgsogjfdnsdfh and not the other. How is this done? What part of the
>code tells it what files names to look for in
>/var/spool/squirrelmail/attach/ during the send process.

When the attach code is ran, the file is uploaded, and dropped into
the $attach_dir folder (saveAttachedFiles() in src/compose.php).  The
temporary name, and actual file name are stored in the Message object
(see line 1399 of src/compose.php and line 1089 of
class/mime/Message.class.php).  This is then serialized, and added to
the compose form.  See the hidden form item attachments around line
1277 in src/compose.php.

When the message is finally ready for sending, the delivery class is
called (class/deliver/Deliver_SMTP.class.php), where writeBody is
executed, which walks through all the attachments, and writes them to
the necessary stream (smtp/sendmail).

That help?

--
Jonathan Angliss
<jon@squirrelmail.org>


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
-----
squirrelmail-devel mailing list
Posting guidelines: http://squirrelmail.org/postingguidelines
List address: squirrelmail-devel@lists.sourceforge.net
List archives: http://news.gmane.org/gmane.mail.squirrelmail.devel
List info (subscribe/unsubscribe/change options): https://lists.sourceforge.net/lists/listinfo/squirrelmail-devel