Operating System - HP-UX
1833187 Members
3323 Online
110051 Solutions
New Discussion

configuring a mail account to save out attachments

 
Chris Beebe_1
New Member

configuring a mail account to save out attachments

Hi

Under hp-ux 11.11 I want to set up and configure an email account to receive mails with attachments and save the attchments into a particular directory, from where a separate application will pick them up and process them. The mails themselves are of no concern, only the attachments.

Can anyone supply any pointers on the simplest way to configure this?

Skill level is low in hp-ux - i'm a DBA with some hp-ux i picked up as i went along :). The simpler the better but if it has to be complicated i'm pretty good at following steps.

Any offers?

Thanks
Chris
5 REPLIES 5
Ivan Krastev
Honored Contributor

Re: configuring a mail account to save out attachments

You can with procmail - http://www.procmail.org/.

Take a look at sorting mails part of procmail.

regards,
ivan

IT_2007
Honored Contributor

Re: configuring a mail account to save out attachments

You need to configure sendmail on the machine where you want to receive mails.

see more info about sendmail here:

http://sendmail.org/

Once you setup sendmail then you can save attachments into folders using mailx or elm utilities.
Chris Beebe_1
New Member

Re: configuring a mail account to save out attachments

Hi IT

sendmail is configured and working fine - the issue lies in how to automate the saving of the attachments. I want to configure a new mail account to automatically save all attachments into a particular directory, preferably at the time the mail comes into the server.

Hope that clarifies the issue.

Ivan - I would prefer to use standard features if possible, rather than third party software. Does procmail replace sendmail or can you ask procmail to only handle one particular mail account?

Thanks
Chris
Chris Beebe_1
New Member

Re: configuring a mail account to save out attachments

Hi

Can anyone offer anything further on this? I didn't think it would be a complicated ask. Sendmail is working. All I need to do is set up an account in such a way that all attachments are automatically directed into a particular directory.

Regards
Chris
Peter Nikitka
Honored Contributor

Re: configuring a mail account to save out attachments

Hi,

setup an alias (e.g. 'getatt') for the mail addresse in your aliases-database (local /etc/aliases or NIS map) of the form:

getatt : |/path/to/attach_distr

In the script 'attach_distr' you will get the mail content just simple as stdin.
As a first attempt, start with somthing like that:

#!/usr/bin/ksh
logdir=/path/to/logdir
logbase=att$(date +%X)
typeset -i id=1
until [ ! -f $logdir/$logbase-$id ]
do ((id+=1))
done
logfile=$logdir/$logbase-$id
cat >$logfile

Change the 'cat' to a more fitting procedure to extract only the requested data.
The above mentioned 'procmail' may be your friend.

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"