Sponsored Content
Top Forums Shell Programming and Scripting Seems Complicated but would b happy if its possible Post 302199816 by nua7 on Wednesday 28th of May 2008 02:04:54 AM
Old 05-28-2008
Use the mailx command in unix to send the mails..

Code:
man mailx

If you are scripting in perl, this might help you..

Code:
sub _send_email($$$) {
	my $recipient = shift;
	my $full_name = shift;
	my $result_file = shift;
	my $res_file = basename($result_file);
	my $res_dir = dirname($result_file);
	chomp(my $hostname = qx/uname -n/);

	my $msg = MIME::Lite->new(
		From => '"Manager Issuance" <abc@@xyz.com>',
		To => "\"$full_name\" <$recipient>",
		Subject => "Results of deck_check.upl for $input_dir on $hostname",
		Type => 'multipart/mixed',
		Data => "The results of your deck_check.upl run are attached."
	);

	$msg->attach(
		Type => 'TEXT',
		Data => "Hello,\n$full_name\n\nPlease DO NOT reply to this email!\n\nIt was generated by a non-user account.  Attached is a file\ncontaining the results of your requested run.\n\nThank You,\n
	);

	$msg->attach(
		Type => 'TEXT',
		Path => "$result_file",
		Filename => "$res_file",
		Disposition => 'attachment'
	);

	$msg->send("sendmail");
}

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Very complicated script..

I have a script that I need to create tha involves moving files and renaming them(see previous post) Are there any websites with user made shell scripts? (5 Replies)
Discussion started by: rocinante
5 Replies

2. Shell Programming and Scripting

More complicated log parsing

Hey Guys, I am trying to grep within a file to find and output certain parts of lines to other file(s). The output files need to have a dynamic file name based on a field in the main log. The problem is that every line of the log is not the same, and often not even similar. To explain... (25 Replies)
Discussion started by: sjug
25 Replies

3. UNIX for Dummies Questions & Answers

complicated(?) grep

Hi all, I need help to figure out this grep. I would like to search all files in a directory for the occurrence of abc AND xyz. I started with this: grep -i abc * | grep xyz But this only returns lines which contain both values on the same line. So I am thinking that I need to do... (5 Replies)
Discussion started by: khearnen
5 Replies

4. Shell Programming and Scripting

Sort complicated two fields

Hi experts, I am trying sort command with my data but still not getting the expected results. For example, I have 5 fields data here c,18:12:45,c,c,c d,12:34:34,d,d,d a,13:50:10,a,a,a b,13:50:50,b,b,b a,13:50:50,a,a,a b,14:10:01,b,b,b c,10:12:45,c,c,c I want to get ... (3 Replies)
Discussion started by: lalelle
3 Replies

5. Shell Programming and Scripting

complicated search within file

Hi, I have following problem. I have a file with time stamps and some data describing what happened between time stamps. Something like this: 10:00 meeting with K meeting with L 11:00 lunch 12:00 work with K 13:00 From this file I have to get a file with... (7 Replies)
Discussion started by: mmike
7 Replies

6. Linux

Complicated Join command!

Hi I have a serious issue when trying to join to files so I have two files, one for meals and one for people Meal1:Turkey:Potato Chips:Twinkie:Coke:5.95 Meal2:Ham & Cheese:Doritos:Cookie:Sprite:6.49 Meal3:Vegetarian:Cheese Crackers:Brownie:Pepsi:5.75 Meal4:Tuna:Cheese Puffs:Eclair:Diet... (1 Reply)
Discussion started by: ehshi1992
1 Replies

7. Shell Programming and Scripting

Complicated job distribution

Hello, This is going to sound convoluted, however, this is how I need to do things. I have three awesome machines and a couple hundred jobs. EACH of these jobs takes approximately 4 hours to complete. I want to give jobs to each of these machines, and their respective CPUs in an intelligent... (1 Reply)
Discussion started by: amcrisan
1 Replies

8. Shell Programming and Scripting

complicated alias command

hi guys i m making one alias which will set variable , invoke sqlplus and also set prompt of sqlplus,,i have made successfully upto invoking sqlplus in unix but cant pass command in sqlplus here is the command alias sett='export ORACLE_SID=devdb2;sqlplus system/system@test' now this... (3 Replies)
Discussion started by: tapia
3 Replies

9. Solaris

Solaris? Is it really this complicated?

Hello Everybody, I am a mid-level Linux administrator trying to get a hold of Solaris. So far, my experience has been painful. I think it's confusing and it's just a big mess... To be more specific, I have noticed that whenever I install a package... it never followed a specific pattern.... (4 Replies)
Discussion started by: EssenceNY
4 Replies

10. Shell Programming and Scripting

Complicated string

I have a data file example 10302|77747373|442422442|290209|244242|"234|2352"|92482892 It has about 5000 rows the same way in that field. Needs to look like this.... I need to remove the quotes but the more difficult thing is to remove the pipe between the quotes because there is a pipe... (6 Replies)
Discussion started by: xgringo
6 Replies
SOAP::Packager(3)					User Contributed Perl Documentation					 SOAP::Packager(3)

NAME
SOAP::Packager - this class is an abstract class which allows for multiple types of packaging agents such as MIME and DIME. DESCRIPTION
The SOAP::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::Packager. parts Contains an array of parts. The contents of this array and their types are completely dependant 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::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::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::Packager::MIME "SOAP::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::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::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::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::Packager::DIME TODO SEE ALSO
MIME::Tools, DIME::Tools COPYRIGHT
Copyright (C) 2000-2004 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 (byrne@majordojo.com) perl v5.12.1 2009-09-30 SOAP::Packager(3)
All times are GMT -4. The time now is 03:45 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy