Convert big email attachments to www link - email

i'm running a mail server that serves mostly architects. the usage of those guys in email is mostly for sending files. today, our mail sending files is limited to about 20MB but the limit is because many webservers reject email that are bigger then 20MB.
what i would like to achieve is that when sending files that are larger then 20MB just to save the files aside and generate a link to download instead.
i would like to know:
are there any plugin to courier that do it?
what tools to i need to use to develop such a plugins?

How to make MTA replace large attachments with links to a centrally-stored copy [MIMEDefang Milter for sendmail/postfix/...]
You may consider using MIMEDefang milter available under GPL license for sendmail and postfix.
MIMEDefang Description
Mail Inspection and Modification
MIMEDefang can inspect and modify e-mail messages as they pass through your mail relay. MIMEDefang is written in Perl, and its filter actions are expressed in Perl, so it's highly flexible. Here are some things that you can do very easily with MIMEDefang:
Delete or alter attachments based on file name, contents, results of a virus scan, attachment size, etc.
Replace large attachments with links to a centrally-stored copy to ease the burden on POP3 users with slow modem links.
[...]

Related

Size limit on E-mail attachments when checking if it is Spam?

I am trying to assess the Spamminess of E-mails. The emails are received in Maildir (on Linux server) via Postfix.
I am completely new to the E-mail domain. So I am curious about the following things:
Do the emails with attachments usually pass through the spam filters?
Is there a size limit (attachment size) that decides this?
My actual question is (when the emails have attachments) will SpamAssassin take longer than usual to assess the email? I am using the Linux version of Apache SpamAssassin.
I can easily extract different parts of the email (including images/PDFs) with JavaMail but, at the end, when I try to pass the file to SpamAssassin, the process never ends. It works fine for smaller attachments (30-40 KB) though.
Did anyone face the same problem? Suggestions are much appreciated.
Thanks!

procmail and delivering to an IMAP server?

I run my own mail server. It uses procmail to filter incoming mail, which is then stored in maildirs and gets served out my MUA using IMAP. I've got about 1.5GB of email is 135000 inodes.
This all works very nicely. However, I'd rather like to stop using maildir and switch to something more efficient --- maildb, or Dovecot's dbox, for example. Unfortunately, procmail can only deliver to a very limited set of backing store formats (Maildir, MH and mbox, AFAICT).
What I'd really like to do is to persuade procmail to deliver email via IMAP, rather than writing it directly to the backing store; this means that I can change the backing store format whenever I like without needing to reconfigure procmail. But I can't find any way of doing this. Any ideas?
(I'm also interested in any other mail filter tools that work like procmail but support IMAP. The only other filter tool I know is maildrop --- but that has similar restrictions to procmail.)
Okay, here's a proper solution.
The cone project (http://www.courier-mta.org/cone/cone00index.html, Debian project: cone) has a very handy tool called mailtool which will copy files between mailbox types, including remote IMAP servers.
So, to deliver a message to a remote mailbox, you need a script which:
writes out the incoming message to a file (which becomes a one-message mbox folder)
does mailtool -tofolder destinationfolder -copyto imaps://username:password#server.com mbox:/full/path/to/message.mbox
That will then upload the message.
I don't actually need to do this any more so don't have a prepared script to post, but of the eight or nine different IMAP tools available, this was the only one that would actually do this, so it's worth documenting as such.
As a partial answer to my own question, it seems that Dovecot does come with a deliver tool specifically designed for this kind of thing; it works from procmail with a line like:
| /usr/lib/dovecot/deliver -m "Folder.Name"
...and it figures out all the rest of the settings automatically.
So now I can change the Dovecot mail storage format and everything will still work; but I'd still like an approach that actually uses IMAP to deliver the messages, so that I can try IMAP servers other than Dovecot's.

Transfer emails to new hosting?

A client is moving from their old hosting to mine. They have a few email accounts on the old hosting and I want to move all the emails on the old hosting to mine. How can I do this? If I download them with POP can I then upload them to the new hosting?
The answer depends on the mail server that you are using. Yes, you can download all the mail messages with POP3, but the upload to your mail server will depend on the type of mail server. I am not aware of any mail servers that provide a tool to import mail messages.
Most mail servers store the email message in a file, and you can certainly drop the files in the folder where they are stored, but that does not mean that it will be visible, you will have to deal with how the mail server index those files.
I suggest looking at the specifications for your mail server.
If you access both accounts with IMAP (most hosts support this now) instead of POP, you can literally drag and drop the messages between folders/inboxes for the two email accounts.
Also, depending on the type of hosting they're moving from/to, you may be able to use a feature of your new server's control panel to do the importing...unless you're doing it manually on a vanilla VPS or dedicated. There are still options, but you'd need to confirm here how your new server is setup and what the old server looks like.
If you're only talking about a couple of accounts with a few folders each, you may just want to consider IMAP as your path of least resistance. The transfer will primarily depend on your own Internet connection, as most hosting companies have connections faster than yours.
Lastly, if both servers share a similar format for the mailbox, you might want to just rsync the email over to the new server (assuming you have root access on both servers) to the proper email directory. Depending on the email box format, you may be able to simply run a server command to "convert" the mailbox to the format your server is expecting.

.eml file common e-mail save format

Mozilla Thunderbird can save e-mails as .eml file. Is this a common e-mail format — can all other common e-mail clients open such a file?
MS Outlook I am sure reads them, along with the old outlook express, and I believe the new LiveMail program. Of course, I guess not all email programs necessarily read them, but I would expect the common mail programs to do so.

How can you save attachments in mails of Gmail to Gdocs?

Problem: to extract many pdf-attachments in Gmail to my Google Docs, and labeling each file by "Python".
One possible solution is this:
Use wireshark with the filter tcp port 80 and do your task a few times manually. Then examine the requests made by your browser in Wireshark.
Then build the script using the httplib module to automate the previously examined requests.
As I know there is a "View as HTML" link in gmail when you receive a PDF attachment. You can use that to convert the documents to google docs.
Any solution to this would be non-trivial and require programmatically reading your mail, iterating through the attachments, cracking the PDFs, opening Google docs, and transcribing the contents of one into the other. I doubt there's any pre-packaged functionality for any of that in the Google APIs, extensive though they may be.
Mailspect offers this, http://esm.mailspect.com/index.php/Attachments_as_Google_Docs