<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to send multiple files as an attachment in single mail through SUSE Linux Script in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/how-to-send-multiple-files-as-an-attachment-in-single-mail/m-p/6969983#M55021</link>
    <description>&lt;P&gt;The -m option in HP-UX is described in the HP-UX mailx(1) man page as:&lt;/P&gt;&lt;PRE&gt;-m
Do not add MIME header lines Mime Version, Content Type &amp;amp; Content Encoding to the header &lt;BR /&gt;information while sending mails.&lt;/PRE&gt;&lt;P&gt;Your script is using a legacy method of sending email attachments: the MIME standard for handling different character sets, attachments and other modern email features has existed since year 1993.&lt;/P&gt;&lt;P&gt;At least on a SuSE SLES 12 SP2 system I had available to me for testing, the SuSE mailx command always adds the MIME header lines and cannot be prevented from adding them. On the other hand, it has option -a for attaching files to messages.&lt;/P&gt;&lt;P&gt;The script is also using "ux2dos" which does not exist in SuSE: the equivalent would be "unix2dos".&lt;/P&gt;&lt;P&gt;Let me suggest an alternative script for you:&lt;/P&gt;&lt;PRE&gt;#!/bin/sh

# script settings here
FOLDERNAME=/logs
&lt;BR /&gt;# create a list of "-a &amp;lt;filename&amp;gt;" options for SuSE mailx
cd "$FOLDERNAME"
for LOGFILE in *
do
    ATTACHMENTS="$ATTACHMENTS -a $LOGFILE"
done
mailx $ATTACHMENTS -s "Subject $(hostname)" narendra.uttekar@xyz.com&lt;/PRE&gt;&lt;P&gt;Using the MIME attachments instead of legacy uuencoding allows the attachments to be opened successfully in both Windows and Unix/Linux systems alike: SuSE mailx is smart enough to detect that the files you're attaching are text files, so it automatically uses the text/plain MIME type to attach them. Then, the receiving email program can automatically convert the line endings if necessary for the destination system, just like it already does for the regular email text, so running the attachments through unix2dos should no longer be necessary.&lt;/P&gt;</description>
    <pubDate>Wed, 05 Jul 2017 09:21:17 GMT</pubDate>
    <dc:creator>Matti_Kurkela</dc:creator>
    <dc:date>2017-07-05T09:21:17Z</dc:date>
    <item>
      <title>How to send multiple files as an attachment in single mail through SUSE Linux Script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-send-multiple-files-as-an-attachment-in-single-mail/m-p/6969828#M55019</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;We want to send&amp;nbsp;multiple files as an attachment in single mail through SUSE Linux Script. But looks like there is no "m" option in SUSE Linux..&lt;/P&gt;&lt;P&gt;Please find the script which we are using in HP-UX&amp;nbsp;as below but same is not working in SUSE Linux&lt;/P&gt;&lt;P&gt;TEMPFILE=/tmp/temp$RANDOM&lt;BR /&gt;if [ -a $TEMPFILE ]&lt;BR /&gt;then&lt;BR /&gt;rm $TEMPFILE&lt;BR /&gt;fi&lt;/P&gt;&lt;P&gt;FOLDERNAME=/logs&lt;BR /&gt;cd $FOLDERNAME&lt;BR /&gt;for file in `ls`&lt;BR /&gt;do&lt;BR /&gt;cat $file | ux2dos | uuencode $file &amp;gt;&amp;gt; $TEMPFILE&lt;BR /&gt;done&lt;BR /&gt;cat $TEMPFILE | mailx -m -s "Subject`hostname`" narendra.uttekar@xyz.com&lt;BR /&gt;rm $TEMPFILE&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Narendra&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jul 2017 12:07:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-send-multiple-files-as-an-attachment-in-single-mail/m-p/6969828#M55019</guid>
      <dc:creator>Narendra1979</dc:creator>
      <dc:date>2017-07-03T12:07:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to send multiple files as an attachment in single mail through SUSE Linux Script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-send-multiple-files-as-an-attachment-in-single-mail/m-p/6969963#M55020</link>
      <description>&lt;P&gt;&amp;gt; We want to send multiple files as an attachment [...]&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Do you want to send multiple files as _an_ attachment, or multiple&lt;BR /&gt;files as _multiple_ attachments (in one message)?&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Programs like Info-ZIP Zip or "tar" (usually used with gzip or bzip2&lt;BR /&gt;(or similar programs) for compression) can be used to package multiple&lt;BR /&gt;files into one, and then one attachment can carry the whole collection.&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; If you want multiple attachments in one message, then you should&lt;BR /&gt;probably look for a real MIME e-mail client program.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jul 2017 06:14:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-send-multiple-files-as-an-attachment-in-single-mail/m-p/6969963#M55020</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2017-07-05T06:14:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to send multiple files as an attachment in single mail through SUSE Linux Script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-send-multiple-files-as-an-attachment-in-single-mail/m-p/6969983#M55021</link>
      <description>&lt;P&gt;The -m option in HP-UX is described in the HP-UX mailx(1) man page as:&lt;/P&gt;&lt;PRE&gt;-m
Do not add MIME header lines Mime Version, Content Type &amp;amp; Content Encoding to the header &lt;BR /&gt;information while sending mails.&lt;/PRE&gt;&lt;P&gt;Your script is using a legacy method of sending email attachments: the MIME standard for handling different character sets, attachments and other modern email features has existed since year 1993.&lt;/P&gt;&lt;P&gt;At least on a SuSE SLES 12 SP2 system I had available to me for testing, the SuSE mailx command always adds the MIME header lines and cannot be prevented from adding them. On the other hand, it has option -a for attaching files to messages.&lt;/P&gt;&lt;P&gt;The script is also using "ux2dos" which does not exist in SuSE: the equivalent would be "unix2dos".&lt;/P&gt;&lt;P&gt;Let me suggest an alternative script for you:&lt;/P&gt;&lt;PRE&gt;#!/bin/sh

# script settings here
FOLDERNAME=/logs
&lt;BR /&gt;# create a list of "-a &amp;lt;filename&amp;gt;" options for SuSE mailx
cd "$FOLDERNAME"
for LOGFILE in *
do
    ATTACHMENTS="$ATTACHMENTS -a $LOGFILE"
done
mailx $ATTACHMENTS -s "Subject $(hostname)" narendra.uttekar@xyz.com&lt;/PRE&gt;&lt;P&gt;Using the MIME attachments instead of legacy uuencoding allows the attachments to be opened successfully in both Windows and Unix/Linux systems alike: SuSE mailx is smart enough to detect that the files you're attaching are text files, so it automatically uses the text/plain MIME type to attach them. Then, the receiving email program can automatically convert the line endings if necessary for the destination system, just like it already does for the regular email text, so running the attachments through unix2dos should no longer be necessary.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jul 2017 09:21:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-send-multiple-files-as-an-attachment-in-single-mail/m-p/6969983#M55021</guid>
      <dc:creator>Matti_Kurkela</dc:creator>
      <dc:date>2017-07-05T09:21:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to send multiple files as an attachment in single mail through SUSE Linux Script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-send-multiple-files-as-an-attachment-in-single-mail/m-p/6969997#M55022</link>
      <description>&lt;P&gt;&amp;gt; [...] so running the attachments through unix2dos should no longer be&lt;BR /&gt;&amp;gt; necessary.&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Info-ZIP Zip and UnZip also offer options to adjust line endings&lt;BR /&gt;(Zip: -l, -ll; UnZip: -a, -aa), so you could probably shed&lt;BR /&gt;ux2dos/unix2dos with that method, too.&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; As usual, many things are possible, and it may help to begin with&lt;BR /&gt;your actual requirements, rather than asking how to implement a&lt;BR /&gt;particular "solution" to a problem.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jul 2017 14:15:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-send-multiple-files-as-an-attachment-in-single-mail/m-p/6969997#M55022</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2017-07-05T14:15:45Z</dc:date>
    </item>
  </channel>
</rss>

