We wish to do the following: 1. receive an email with an attachment 2. process the email body to get some information from it 3. send an outbound email to an email address based on the information derived from step 2. The email will include the attachment received in step 1
I'm not sure where to start with this one so any suggestions would be appreciated.
On Mon, 21 Sep 2009 05:49:29 +1200 CSB wrote:
We wish to do the following:
- receive an email with an attachment
- process the email body to get some information from it
- send an outbound email to an email address based on the information
derived from step 2. The email will include the attachment received in step 1
You should be able to string a few commands together in a script to get what you want, part of which depends on how you pick up and send out your email. Do you have your own mailserver?
If you don't have your own mailserver (or even if you do), this is one solution:
Step 1: fetchmail or getmail. I personally prefer getmail but that's just me.
Step 2: http://www.codealias.info/technotes/extracting_attachment_from_e-mail_using_...
Step 3: http://www.cleancode.org/projects/email
If you have your own mailserver, you can do steps 1 and 3 in a more "direct" manner, if you wish.
Use a mailer.
That gives you complete control over how you process incoming messages since it will be your own program.
We can implement it for you if you like.
Thanks, Neil
-- Neil Aggarwal, (281)846-8957, www.JAMMConsulting.com Will your e-commerce site go offline if you have a DB server failure, fiber cut, flood, fire, or other disaster? If so, ask about our geographically redundant database system.
-----Original Message----- From: centos-bounces@centos.org [mailto:centos-bounces@centos.org] On Behalf Of CSB Sent: Sunday, September 20, 2009 12:49 PM To: centos@centos.org Subject: [CentOS] Receive, process and send email
We wish to do the following:
- receive an email with an attachment
- process the email body to get some information from it
- send an outbound email to an email address based on the information
derived from step 2. The email will include the attachment received in step 1
I'm not sure where to start with this one so any suggestions would be appreciated.
CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
On Mon, 21 Sep 2009, CSB wrote:
We wish to do the following:
- receive an email with an attachment
- process the email body to get some information from it
- send an outbound email to an email address based on the information
derived from step 2. The email will include the attachment received in step 1
I'm not sure where to start with this one so any suggestions would be appreciated.
procmail is a good place to start. There are multiple man pages and examples. Experiment with a throw away account til you get it figured out. It is easy to do strange and unexpected things...
---------------------------------------------------------------------- Jim Wildman, CISSP, RHCE jim@rossberry.com http://www.rossberry.com "Society in every state is a blessing, but Government, even in its best state, is a necessary evil; in its worst state, an intolerable one." Thomas Paine
CSB wrote:
We wish to do the following:
- receive an email with an attachment
- process the email body to get some information from it
- send an outbound email to an email address based on the information
derived from step 2. The email will include the attachment received in step 1
I'm not sure where to start with this one so any suggestions would be appreciated.
Directing received email to a program can be done either with a sendmail alias that pipes to a program or a procmail recipe, depending on whether the address is a real system user or not.
If you want to program in perl, look at MIME::tools to parse the inbound copy's body and attachments and perhaps Mail::Sender to reassemble and re-send.
On Sunday 20 September 2009, "CSB" kjcsb@xnet.co.nz wrote:
We wish to do the following:
- receive an email with an attachment
- process the email body to get some information from it
- send an outbound email to an email address based on the information
derived from step 2. The email will include the attachment received in step 1
I'm not sure where to start with this one so any suggestions would be appreciated.
If it's a minor amount of processing, you can just pipe it to a script from procmail or even straight from the MTA. I don't really like that mechanism though - too prone to produce bounces in the case of long processing times or errors. It's better to dump them in a Maildir and use it as a queue for a polling script.
Perl in particular has a bunch of libraries available to correctly parse MIME messages and extract addresses and attachments and stuff. Don't write your own parser.
2009/9/21 Alan Hodgson ahodgson@simkin.ca
On Sunday 20 September 2009, "CSB" kjcsb@xnet.co.nz wrote:
We wish to do the following:
- receive an email with an attachment
- process the email body to get some information from it
- send an outbound email to an email address based on the information
derived from step 2. The email will include the attachment received in step 1
I'm not sure where to start with this one so any suggestions would be appreciated.
If it's a minor amount of processing, you can just pipe it to a script from procmail or even straight from the MTA. I don't really like that mechanism though - too prone to produce bounces in the case of long processing times or errors. It's better to dump them in a Maildir and use it as a queue for a polling script.
Perl in particular has a bunch of libraries available to correctly parse MIME messages and extract addresses and attachments and stuff. Don't write your own parser.
talkin' about perl, i remember once i used something called milter for things like this .
-- "No animals were harmed in the recording of this episode. We tried but that damn monkey was just too fast." _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
cornel panceac wrote:
talkin' about perl, i remember once i used something called milter for things like this .
milters are plugins for sendmail that are used to filter ALL the mail passing through a given sendmail installation. most commonly used for anti-spam and anti-virus plugins.
John R Pierce wrote:
cornel panceac wrote:
talkin' about perl, i remember once i used something called milter for things like this .
milters are plugins for sendmail that are used to filter ALL the mail passing through a given sendmail installation. most commonly used for anti-spam and anti-virus plugins.
You actually could do it with a milter - especially a comprehensive one like MimeDefang that knows how to deal with attachments. But if they are sent to a single known address it probably makes more sense to pipe to a program or use procmail during delivery.