Sponsored Content
Full Discussion: problem
Top Forums Shell Programming and Scripting problem Post 20762 by Perderabo on Friday 3rd of May 2002 10:59:08 AM
Old 05-03-2002
I am working on a script that assembles mime mail. To help me, I have a subdirectory with mime mail messages from several sources, including outlook.

Every Outlook mime attachment that I have goes like this:
Code:
Content-Type: text/plain;
        name="accesses.txt"
Content-Disposition: attachment;
        filename="accesses.txt"

This is the issue that Rado1x mentioned. Other mailers would have done that in two lines rather than four. But the Microsoft technique is legal. Your detachment program simply must handle this case.

If you really have just lines 1 and 3 (and therefore no names), maybe the program could generate a name.

If you have no source to the detachment program, maybe you can write a script that will copy the mail, but add a filename to attachments with no name. (Or join the two lines, depending on which problem you have.) Then just run the script as a intermediate procedure.
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

SSH Problem auth problem

Hi, Just recently we seem to be getting the following error message relating to SSH when we run the UNIX script in background mode: warning: You have no controlling tty. Cannot read confirmation.^M warning: Authentication failed.^M Disconnected; key exchange or algorithm negotiation... (1 Reply)
Discussion started by: budrito
1 Replies

2. Shell Programming and Scripting

problem with dd command or maybe AFS problem

Hi, folks. Sorry for bothering, but maybe someone could help me please. The problem is the following: there is some script that copies files from local file system to AFS. The copying is performed with dd command. The script copies data into some AFS volumes. The problem appeared with one... (0 Replies)
Discussion started by: Anta
0 Replies

3. Shell Programming and Scripting

ssh script problem problem

Hi Please help me with the following problem with my script. The following block of code is not repeating in the while loop and exiting after searching for first message. input_file ========== host001-01 host001-02 2008-07-23 13:02:04,651 ConnectionFactory - Setting session state... (2 Replies)
Discussion started by: pcjandyala
2 Replies

4. Solaris

problem in finding a hardware problem

Hi I am right now facing a strange hardware problem. System get booted with the following error: Fatal Error Reset CPU 0000.0000.0000.0003 AFSR 0100.0000.0000.0000 SCE AFAR 0000.07c6.0000.1000 SC Alert: Host System has Reset It happen 4 or 5 times and get the same error every time.I... (8 Replies)
Discussion started by: girish.batra
8 Replies

5. AIX

user login problem & Files listing problem.

1) when user login to the server the session got colosed. How will resolve? 2) While firing the command ls -l we are not able to see the any files in the director. but over all view the file system using the command df -g it is showing 91% used. what will be the problem? Thanks in advance. (1 Reply)
Discussion started by: pernasivam
1 Replies

6. Red Hat

Mail Problem. Maybe, it is a DNS Problem!

Hi, i've a redhat linux 9 upadated by redhat from 7 version to 9 version. A couple of days ago i was a problem with my mail, in other words i'm not able to get any email nor to send any email. I've a proxy configuration and i tried to set iptables in order to verify the port. The 110,255 and 995... (1 Reply)
Discussion started by: pintalgi
1 Replies

7. UNIX for Dummies Questions & Answers

DHCP problem and eth1 problem

At work I am trying to get this one Linux machine (let's call it ctesgm07) to behave like another Linux machine that we have (let's call it test007). test007 returns the following version info: cat /etc/debian_version: lenny/sid uname -a: Linux test007 2.6.27-7-generic #1 SMP Tue Nov 4... (0 Replies)
Discussion started by: sllinux
0 Replies

8. AIX

AIX OS problem? network problem?

Dear ALL. I installed AIX OS on customer sites. but Only one site is too slow when I connected telnet, ftp.. Ping is too fast. but telnet and FTP is not connected.. of course i check the configuration file on aix but it's normal. Do any Idea?? thanks in advance. - Jun - (3 Replies)
Discussion started by: Jeon Jun Seok
3 Replies

9. IP Networking

Problem with forwarding emails (SPF problem)

Hi, This is rather a question from a "user" than from a sys admin, but I think this forum is apropriate for the question. I have an adress with automatic email forwarding and for some senders (two hietherto), emails are bouncing. This has really created a lot of problems those two time so I... (0 Replies)
Discussion started by: carwe
0 Replies

10. UNIX for Dummies Questions & Answers

sed Or Grep Problem OR Terminal Problem?

I don't know if you guys get this problem sometimes at Terminal but I had been having this problem since yesterday :( Maybe I overdid the Terminal. Even the codes that used to work doesn't work anymore. Here is what 's happening: * I wanted to remove lines containing digits so I used this... (25 Replies)
Discussion started by: Nexeu
25 Replies
MIME-CONSTRUCT(1p)					User Contributed Perl Documentation					MIME-CONSTRUCT(1p)

NAME
mime-construct - construct and optionally mail MIME messages SYNOPSIS
mime-construct switch... Sorry, it's hard to provide a meaningful synopsis. See the examples. DESCRIPTION
mime-construct constructs and (by default) mails MIME messages. It is entirely driven from the command line, it is designed to be used by other programs, or people who act like programs. OPTIONS
Global Settings --debug Turn debugging on. --help Show the usage message and die. --output Don't mail the generated message, print it to stdout instead. This loses --bcc info. --subpart Generate a subpart which can be used in another MIME message, rather than a top-level MIME message itself. This turns on --output and changes some internal semantics a bit. See the examples. --version Print the version and exit successfully, if this is the only arg. Otherwise, print the version and die. Main Header These arguments add text to the top-level header of the message, or control who it gets sent to. --bcc address Add address to the recipient list. This doesn't actually add anything to the header, of course. If you're not actually mailing the message (if you use --output or --subpart) --bcc will have no effect. --cc address Add an address to the Cc: list. --embedded-to Send the message to the recipients already listed in the header, in addition to those given with --to, --cc, and --bcc. This makes sense if you use the --header switch to add your own To: or Cc:. In this case you probably don't want to use --to or --cc because they would create new headers rather than adding to the ones already in the message. This switch passes the -t switch to sendmail (mime-construct doesn't try to parse the headers you provide), so it doesn't really do anything if you're not mailing the message. --header str Add arbitrary text to the header. The str can be anything you like, including multiple lines. You can create invalid messages this way. If you include a blank line in the str you'll really screw up the message. --multipart str This specifies the multipart content type and options. The default is "multipart/mixed". Don't include a "boundary" setting, that's supplied by mime-construct. It's okay if you specify the --multipart type but the message turns out to be a single part, the type you supply will just be ignored. --prelude str This adds str to the multipart prelude text. If you specify --prelude multiple times the strs will all be concatenated. There isn't any default for this text. It seems to me that nowadays adding an explanation of MIME to the beginning of a message is like explaining how to use a seat buckle to people who are riding in an airplane. It's okay if you specify the --prelude but the message turns out to be a single part, the prelude you supply will just be ignored. --subject str Specify the subject for the message. --to address Add an address to the To: list. Per-part Header These switches control the per-part headers. If the message turns out not to be multipart they actually add data to the top level header. Each of these applies only to the next part output. After each part is output they are reset to their default values. It doesn't make sense to use them without a following part, so mime-construct will sputter and die if you try to do that. --attachment name This adds a "Content-Disposition: attachment" header with the given name as the value of the "filename" attribute. It's just a convenience, since mime-construct is often used to send files as attachments. Using --attachment name does not cause mime-construct to read any data from the file called name! It just uses that name in the header. The actual data which will go into this part of the message comes from one of the regular part output switches (given below). You might prefer to use the --file-attach switch, which does read from the named file. --encoding type This specifies the type of encoding you want this part to use. You normally shouldn't use this switch, though. If this switch isn't used mime-construct will choose an appropriate encoding. The data you supply mustn't be encoded already, mime-construct will encode it according to the type you specify here. Valid encodings are 7bit, 8bit, binary, quoted-printable, and base64. It's easy to generate an illegal MIME message by specifying the encoding yourself. --part-header str Add arbitrary text to the per-part header. The str can be anything you like, including multiple lines. You can create invalid messages this way. If you include a blank line in the str you'll really screw up the message. --type type Specify the content type for this part. If you don't specify a --type it defaults to "text/plain". The type you supply can contain not only the type proper but also options. The whole thing will just be plopped onto the end of "Content-Type:" and stuck into the header. You might prefer to use the --file-auto or --file-attach switches, which set the --type automatically based on a file's name. Part Output These switches add data to the body of the message. You use one of these for each for each part of a multipart message (or just one of them if the message isn't to be multipart). --file path --file-auto path --file-attach path --attach path --string str --body str Use the contents of the file path or the literal string str as the body of this part. --file-auto causes the Content-Type to be set based on the file's name, if possible. --file-attach does that and sets the --attachment name as well. Be sure to include the trailing newline on str unless there really isn't supposed to be one. If you leave the trailing newline off the part will have to be encoded in "base64" (because "quoted-printable" has an artificial limitation which prevents it from being able to encode such a data stream). --attach is an alias for --file-attach, and --body is an alias for --string. --subpart-file path --subpart-string str Use either the contents of path or str itself as the body of this part, but treat it as a subpart. This means that the data contains both some headers and some text. It also means that you can't use --type or --encoding for this part. Normally the path or str will have been generated by a different invocation of mime-construct which was given the --subpart switch. Arguments to switches which take a file name (such as --file and --subpart-file) can have some magic. If there is no file with the path supplied a regular Perl open() is done on it. See "EXAMPLES". EXAMPLES
The examples assume that $nl contains a newline. The other variables used are I hope self-explanatory. Send a simple message. mime-construct --to "$recip" --subject 'hi there' --string "$body" Send a message which is read from stdin. fortune | mime-construct --to "$recip" --subject fortune --file - Send a plain text part and attach a file, setting the file's content type and --attachment name automatically. mime-construct --to "$recip" --subject "$file" --string "Here's the file I told you about.$nl" --file-attach "$file" Most people think of attachments as multipart messages, but they don't have to be. This generates a zip of all the files in the current directory and sends them as an attachment but as a single part message. zip -q - * | mime-construct --to "$recip" --subject 'zipped directory' --attachment dir.zip --type application/zip --file - You can use the full expressiveness of Perl's open() when constructing file names. Eg, you can run processes XXX bad examples, there's no file names mime-construct --to "$recip" --subject "$subject" --string "Here are those two files you wanted.$nl" --type application/x-gzip --attachment file1.gz --file 'gzip -c file1 |' --type application/x-gzip --attachment file1.gz --file 'gzip -c file2 |' or read from alternate file descriptors ("<&=4" to read from file descriptor 4) or whatever. See perlopentut for a tutorial. Here's an example of using a separate invocation of mime-construct to create a subpart. This creates a message which has two parts at the top level. The first part is some text, the second part is a digest. The digest itself is a multipart message which contains a number of message/rfc822 parts. msg_args= for msg in $msg_list do msg_args="$msg_args --type message/rfc822 --file $msg" done set fnord for recip in $recip_list do set "$@" --bcc $recip done shift mime-construct --subpart --multipart multipart/digest $msg_args | mime-construct --header "To: Digest recipients:;$nl" --subject 'Foo digest' "$@" --file "$introduction" --subpart-file - Here is how to send an encrypted messages (multipart/encrypted, as defined in RFC 1847). You use mime-construct "--subpart" to generate the real message you want to send (which can be kind of MIME message -- non-text, multi-part, what have you), then encrypt that and use another mime-construct to contruct and send the multipart/encrypted message which contains it. enc_type=application/pgp-encrypted enc_params="Version: 1$nl" mime-construct --subpart --file body --file-auto image.jpg | gpg --encrypt --armor -r "$recip" | mime-construct --output --to "$recip" --subject "$subject" --multipart "multipart/encrypted; protocol="$enc_type"" --type "$enc_type" --string "$enc_params" --type application/octet-stream --file - BUGS
The body of the message is always held in memory, so you can expect problems if you work with bodies which are large compared to the amount of memory you've got. AVAILABILITY
The code is licensed under the GNU GPL. Check http://www.argon.org/~roderick/ for updated versions. AUTHOR
Roderick Schertler <roderick@argon.org> perl v5.10.1 2010-06-23 MIME-CONSTRUCT(1p)
All times are GMT -4. The time now is 05:09 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy