Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Need help sending attachment via mailx Post 302965344 by gandolf989 on Wednesday 27th of January 2016 01:26:11 PM
Old 01-27-2016
If you don't mind using Perl, you can download and install Perl MIME::LITE and use that.
The link includes some sample code. Last time I looked the module had not changed
in awhile. But the code works and it is easy to use.

MIME::Lite - search.cpan.org
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

mail or mailx attachment

I have used the forum to determine the format required to send attachments from hp-ux 11. the problem I have is that using mailx does not attach the file, but subsititing mailx for mail on the command line attaches the file but i'm not able to specify a subject? The attachment has been convert... (3 Replies)
Discussion started by: brettmartin99
3 Replies

2. Shell Programming and Scripting

Problem with mailx command when sending attachment.

Hi, I have tried to sent a mail with body and attachment. But the shell script got hanging while executing that command. The command is "(cat body;uuencode att1.csv)|mailx -s "Production Monitoring Report(Unix Side)" milton.yesusundaram@patni.com" where body is a file having a single line.... (2 Replies)
Discussion started by: miltony
2 Replies

3. Shell Programming and Scripting

Sending email with text & attachment using mailx

I spent some time working this out, with a little help from various forums, and thought the community would like to know : Here is how you can send an email from a single Unix command line : /usr/bin/echo "Email text\nNew line\nAnother new line" >x | uuencode sourcefile.txt sourcefile.txt |... (3 Replies)
Discussion started by: haryadoon
3 Replies

4. Shell Programming and Scripting

Problem while sending message and attachment with mailx

Hi All, I am trying to send a mail with an attachment and message. Following command I am using. (cat <messagefile> ; uuencode <attachmentfile> <attachmentfile>)|mailx -s"Subject" dave@email.com In the received mail, message body is appearing fine. But attachment is not coming. Rather... (2 Replies)
Discussion started by: nihar.dutta
2 Replies

5. Shell Programming and Scripting

mailx attachment sending large file

Hi I want to sent attachment file which is 400mb size.(single file, not tar file) is there any way that these kind of large files can be divided into small sizes and sent as attachments thanks with anticipation (3 Replies)
Discussion started by: karthikn7974
3 Replies

6. Shell Programming and Scripting

Adding an attachment as an attachment to mailx

I don't want the attachment embedded in the mail. I would like a file attached. When I do mailx -s "Report, `date +'%D %r` " -r "Notifications" bob@bob.com < /usr/local/bin/myreport.log> /dev/null It gets embedded in my email. I want a file attachment. How do I do that? (2 Replies)
Discussion started by: guessingo
2 Replies

7. Shell Programming and Scripting

Mailx: How to send a attachment using mailx command

Hi All, Can anyone please provide the command for sending an mail with attachment using mailx command. Thanks in Advance :) Regards, Siram. (3 Replies)
Discussion started by: Sriram.Vedula53
3 Replies

8. HP-UX

mailx with -m attachment corrupted

mailx with -m command sending emails with attachments correctly to all users except users who have email on microsoft exchange server. They are receiving attachments as garbled text in mail body (5 Replies)
Discussion started by: sankalpag
5 Replies

9. Shell Programming and Scripting

mailx not sending excel attachment properly

Hi, I am trying to send email with attachment using mailx command. I am using the folowing command: uuencode XX_HWSW_BUYERWISE_88963631_1.xls XX_HWSW_BUYERWISE_88963631_1.xls | mailx -s "Test Mail as Attachment" oracleams@xyz.com I get the email in the inbox. However, when I try to open the... (5 Replies)
Discussion started by: asp_julius
5 Replies

10. Solaris

mailx with attachment

Hi, When i used below command, i am able to send mail mailx -s "Testing mail working or not " babu.sudhakar@ymail.com" but if i want send attachment with mail,which syntax i need to follow to send a file as attachment. (3 Replies)
Discussion started by: sridhardwh
3 Replies
SOAP::Lite::Packager(3pm)				User Contributed Perl Documentation				 SOAP::Lite::Packager(3pm)

NAME
SOAP::Lite::Packager - this class is an abstract class which allows for multiple types of packaging agents such as MIME and DIME. DESCRIPTION
The SOAP::Lite::Packager class is responsible for managing a set of "parts." Parts are additional pieces of information, additional documents, or virtually anything that needs to be associated with the SOAP Envelope/payload. The packager then will take these parts and encode/decode or "package"/"unpackage" them as they come and go over the wire. METHODS
new Instantiates a new instance of a SOAP::Lite::Packager. parts Contains an array of parts. The contents of this array and their types are completely dependent upon the Packager being used. For example, when using MIME, the content of this array is MIME::Entity's. push_part Adds a part to set of parts managed by the current instance of SOAP::Lite::Packager. parser Returns the parser used to parse attachments out of a data stream. headers_http This is a hook into the HTTP layer. It provides a way for a packager to add and/or modify HTTP headers in a request/response. For example, most packaging layers will need to override the Content-Type (e.g. multipart/related, or application/dime). ABSTRACT METHODS
If you wish to implement your own SOAP::Lite::Packager, then the methods below must be implemented by you according to the prescribed input and output requirements. package() The "package" subroutine takes as input the SOAP envelope in string/SCALAR form. This will serve as the content of the root part. The packager then encapsulates the envelope with the parts contained within "parts" and returns the properly encapsulated envelope in string/SCALAR form. unpackage() The "unpackage" subroutines takes as input raw data that needs to be parsed into a set of parts. It is responsible for extracting the envelope from the input, and populating "parts" with an ARRAY of parts extracted from the input. It then returns the SOAP Envelope in string/SCALAR form so that SOAP::Lite can parse it. SUPPORTED PACKAGING FORMATS
SOAP::Lite::Packager::MIME "SOAP::Lite::Packager::MIME" utilizes MIME::Tools to provides the ability to send and receive Multipart/Related and Multipart/Form-Data formatted requests and responses. MIME METHODS The following methods are used when composing a MIME formatted message. transfer_encoding The value of the root part's Content-Transfer-Encoding MIME Header. Default is: 8bit. env_id The value of the root part's Content-Id MIME Header. Default is: <main_envelope>. env_location The value of the root part's Content-Location MIME Header. Default is: /main_envelope. env_type The value of the root part's Content-Type MIME Header. Default is: text/xml. OPTIMIZING THE MIME PARSER The use of attachments can often result in a heavy drain on system resources depending upon how your MIME parser is configured. For example, you can instruct the parser to store attachments in memory, or to use temp files. Using one of the other can affect performance, disk utilization, and/or reliability. Therefore you should consult the following URL for optimization techniques and trade-offs: http://search.cpan.org/dist/MIME-tools/lib/MIME/Parser.pm#OPTIMIZING_YOUR_PARSER To modify the parser's configuration options consult the following code sample, which incidentally shows how to minimize memory utilization: my $packager = SOAP::Lite::Packager::MIME->new; # $packager->parser->decode_headers(1); # no difference # $packager->parser->extract_nested_messages(1); # no difference $packager->parser->output_to_core(0); # much less memory $packager->parser->tmp_to_core(0); # much less memory $packager->parser->tmp_recycling(0); # promotes faster garbage collection $packager->parser->use_inner_files(1); # no difference my $client = SOAP::Lite->uri($NS)->proxy($URL)->packager($packager); $client->someMethod(); CLIENT SIDE EXAMPLE The following code sample shows how to use attachments within the context of a SOAP::Lite client. #!/usr/bin/perl use SOAP::Lite; use MIME::Entity; my $ent = build MIME::Entity Type => "text/plain", Path => "attachment.txt", Filename => "attachment.txt", Disposition => "attachment"; $NS = "urn:Majordojo:TemperatureService"; $HOST = "http://localhost/cgi-bin/soaplite.cgi"; my $client = SOAP::Lite ->packager(SOAP::Lite::Packager::MIME->new) ->parts([ $ent ]) ->uri($NS) ->proxy($HOST); $response = $client->c2f(SOAP::Data->name("temperature" => '100')); print $response->valueof('//c2fResponse/foo'); SERVER SIDE EXAMPLE The following code shows how to use attachments within the context of a CGI script. It shows how to read incoming attachments, and to return attachments to the client. #!/usr/bin/perl -w use SOAP::Transport::HTTP; use MIME::Entity; SOAP::Transport::HTTP::CGI ->packager(SOAP::Lite::Packager::MIME->new) ->dispatch_with({'urn:Majordojo:TemperatureService' => 'TemperatureService'}) ->handle; BEGIN { package TemperatureService; use vars qw(@ISA); @ISA = qw(Exporter SOAP::Server::Parameters); use SOAP::Lite; sub c2f { my $self = shift; my $envelope = pop; my $temp = $envelope->dataof("//c2f/temperature"); use MIME::Entity; my $ent = build MIME::Entity Type => "text/plain", Path => "printenv", Filename => "printenv", Disposition => "attachment"; # read attachments foreach my $part (@{$envelope->parts}) { print STDERR "soaplite.cgi: attachment found! (".ref($part).") "; print STDERR "soaplite.cgi: contents => ".$part->stringify." "; } # send attachments return SOAP::Data->name('convertedTemp' => (((9/5)*($temp->value)) + 32)), $ent; } } SOAP::Lite::Packager::DIME TODO SEE ALSO
MIME::Tools, DIME::Tools COPYRIGHT
Copyright (C) 2000-2007 Paul Kulchenko. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. AUTHORS
Byrne Reese Martin Kutter <martin.kutter fen-net.de> perl v5.12.4 2010-06-03 SOAP::Lite::Packager(3pm)
All times are GMT -4. The time now is 02:18 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy