Solved

mailx attachements

Posted on 2002-06-06
10
7,498 Views
Last Modified: 2013-12-16
Hi..........
How do i send email from the command line using mailx.
how do specify:
to
from
subject
attachements
...R
0
Comment
Question by:rickyr
10 Comments
 
LVL 51

Expert Comment

by:ahoffmann
Comment Utility
> to
mailx to@some.where

> from
not possibly, usually (except you give UNIX flaviour and version, and mailx version)

> subject
mailx -ssubject ...

> attachements
not possible, usually
or see http://www.experts-exchange.com/unix/Q_20305167.html
or see "from" comment above
0
 
LVL 38

Expert Comment

by:yuzh
Comment Utility
As  ahoffmann told you, it is not possible to do this with mailx.

You can use GUI mail client in Solaris, set your DISPLAY,
type in :

/usr/dt/bin/dtmail

Will allow you do the job
0
 
LVL 15

Expert Comment

by:samri
Comment Utility
rickyr,

Or maybe you could encode the file (maybe using uuencode) first, and pipe it to mailx, it might work.

cheers
0
 
LVL 51

Expert Comment

by:ahoffmann
Comment Utility
> .. uuencode .. pipe .. mail .. it might work
NO.
It does not produce a MIME attachement.
0
 
LVL 3

Author Comment

by:rickyr
Comment Utility
I am thinking of using a perl module to do this!
whoever sends the most complete example gets an "A"
............R
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 51

Accepted Solution

by:
ahoffmann earned 200 total points
Comment Utility
#! /usr/bin/perl
use MIME::Lite;
if ($#ARGV < 3) {
        print "usage: $0 <to> <subject> <text file> <attachement file>\n";
        exit( 1 );
} else {
        $to     = shift;
        $subject= shift;
        $text   = shift;
        $file   = shift;
}
$data     = `cat $text`;
$msg = new MIME::Lite
  From     => 'user@some.where',
  To       => $to,
  Subject  => $subject,
  Type     => 'multipart/mixed';
attach $msg
  Type     => 'TEXT/plain',
  Data     => $data;
attach $msg
  Type     => 'application/pdf';
  Encoding => 'base64',
  Path     => $file;
#print $msg->print_header;
#print $msg->header_as_string;
#print $msg->print_body;
#print $msg->body_as_string;

$msg->send;
exit 0;
0
 
LVL 1

Expert Comment

by:haeger
Comment Utility
I think that I've sent attachments from IRIX via mailx. It's been tarfiles and gzipped files.

mailx -s the_subject someone@somewhere.com < the_file

I'm certain that I've sent textfiles this way.
0
 
LVL 51

Expert Comment

by:ahoffmann
Comment Utility
haeger, you can send files this way, but it is not an attachement, just plain text
0
 
LVL 20

Expert Comment

by:Gns
Comment Utility
So true ahoffmann.

On systems that only provide mailx as MUA, you can be lucky and have the metamail package. And even more lucky, so that mailx actually has been configured to filter inbound mail through it.
For outbound "attachments", you'd have to use some metamail command like mimeencode, mimesend or somesuch.

This is the case with Data Generals crufty ol' DG/UX.

But if you're set on perl, more power to you.

-- Glenn
0
 
LVL 3

Author Comment

by:rickyr
Comment Utility
better late than never!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Java core in Solaris 10 1 228
Oracle Finace 3 43
MarkLogic 1 47
How do disable only TLSv1.0 in Oracle Sun One 7.1 Server 9 33
Hello fellow BSD lovers, I've created a patch process for patching openjdk6 for BSD (FreeBSD specifically), although I tried to keep all BSD versions in mind when creating my patch. Welcome to OpenJDK6 on BSD First let me start with a little …
Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now