spartacus
13th July 2007, 14:36
Hi all,

does anybody know, what the maximum length of a k-shell command line is?

I am sending mails from Unix with "mailx" and would like to send that mail to a list of recipients. I'm not sure how long this list can be!?

mark_h
13th July 2007, 15:13
I was told the address list must be less than 1024 by someone(can't remember who) and if you needed something larger you needed to use aliases.

spartacus
13th July 2007, 15:50
Hi Mark,

thanks. At least something I can keep an eye on :-)

patvdv
14th July 2007, 01:08
Spartacus,

I assume that by 'k-shell' you mean Korn Shell. The max character length of a command line in the KSH is usually 4096

mark_h
14th July 2007, 04:58
Spartacus,

I assume that by 'k-shell' you mean Korn Shell. The max character length of a command line in the KSH is usually 4096

Good point - I did not catch that. I saw mailx and address list and quoted was I was told about using the csh. Is there a limit on the mailx address list in the ksh that might be less than 4096? Just curious.

patvdv
16th July 2007, 11:22
Hi Mark,

I don't mailx imposes a specific limit below 4096. But to 100% sure of proper operation and for the sake of maintenability, it is better not to use a whole slew of addresses on the command line but rather to define an alias for a all these addresses in your local /etc/mail/aliases file.

spartacus
16th July 2007, 12:17
Hi all,

sorry, yes I meant the "normal" Baan KSH. Ok: 4096 character ist a very good value to work with. I agree with Patrick: Put a list with recipients in the command line, is not a nice solution. To use an aliases file seems to be a very smart way.
At the moment I have no glue how to make it really work, but I will gather information to have an alternative solution. But in a first approach I will try to send the mails one by one.

shah_bs
16th July 2007, 21:54
Here is one way of sending emails with one attached document. These are general ideas, you may have to experiment some to make it work. I am assuming a Unix environment.

1. Create a 'preamble' file having the following format in (say) /tmp directory:


To: receipient@receivingcompany.com
From: sender@sendingcompany.com
Reply-To: sender@sendingcompany.com
CC: sender@sendingcompany.com
MIME-Version: 1.0
Subject: Here’s the subject line
Content-Type: multipart/mixed; boundary=b_xxyyzz_boundary

--b_xxyyzz_boundary

************************************************
* Here some useful message for the receipient. *
************************************************

--b_xxyyzz_boundary
Content-Type: text
Content-Disposition: attachment; filename=document.csv


2. I assume you have somehow created the file 'document.csv' separately, also in the /tmp directory.

3. Assemble the following commandline and then call it from within the BAAN session (this is as per my computer here - may have changes for your computer.):


/usr/bin/cat /tmp/preamble.txt /tmp/document.csv | /usr/bin/sendmail -t -i -f yourself@yourcompany.com


That single email address (yourself@yourcompany.com) is required by sendmail on the commandline, for some reason, in my computer setup, otherwise the email is not sent. But all the receipients are in the preamble file. This is not a problem, since you would want a copy too.

[If you need to get into more details, you can search and download the RFC1341 (Request for Comment "MIME - (Multipurpose Internet Mail Extensions): Mechanisms for Specifying and Describing the Format of Internet Message Bodies")].

spartacus
18th July 2007, 11:24
Hi all,

thanks for your support.

I hopefully changed the problem with very little effort. I still stuck on the old "shell"-command (shame on me ;-)) and just switched the mode from "SHELL_BACKGROUND" to "SHELL_NO_OUTPUT".
IMO the shell-call works now modal. So every call has to be finished, before the next ist processed. I think that gives the mail-server more time to react.
Tests we run already work fine, hope this will also be the case on production system.