  | |  | Help Me with shell script please | Help Me with shell script please 2004-01-16 - By Jason Dixon
Back On Fri, 2004-01-16 at 21:01, Ben Yau wrote:
> Because to my untrained eye (untrained in mail::internet) your perl script
> did not represent any "refined control " and I was wondering where that was
> coming from. I 'll explain that in more detail in the next section because
> that 's where it 's more relevant
That one-liner is a simple solution to your original question. It
doesn 't provide any fine-grained control, as your OP didn 't suggest you
needed it. However, I did mention Mail::Internet in the off-chance that
you might need something like that later on. It 's up to you to
investigate the module 's features if you think you 'll find it useful.
> 1) your example above looks like a regular perl script, which to me doesn 't
> have much of an advantage over running it from the command line, and to my
> untrained eye definitely wouldn 't give you refined control over headers.
> In fact, it is less desirable because you 're just addig a wrapper to 'mail '.
> Why not just run 'mail ' directly from bash instead of running it from perl
> which will run it from bash?
Fine.
$ for i in `cat address.txt`; do echo "message goes here " | mail -s
"subject goes here " $i; done
Feel better now?
> 2) since I give everyone the benefit of the doubt, and since I 'm not
> familiar with Mail::Internet, I was assuming I was missing something, which
> is why I was asking for clarification and which is also why I said in the
> email you responded to:
No, you weren 't missing anything. I was just tossing out a tidbit for
future investigation, if you 're so inclined. This is all getting a
little ridiculous. If you want to use the Perl one-liner, feel free.
If not, use your own code or the shell example I gave above. I 'm sure
you feel I 've slighted you somehow even though I 've taken out of my own
time to give you an example, while you 've taken time to nitpick
everything in my posts.
Nevertheless, I 'm going to lay this out for you, just so you can 't say I
never explained Mail::Internet.
=================================================
#!/usr/bin/perl
use strict;
use Mail::Internet;
my $head = Mail::Header- >new(Modify = > 1);
$head- >add(From = > 'joe@(protected) ');
$head- >add(To = > 'jane@(protected) ');
$head- >add(Subject = > 'Just a test mail ');
$head- >add(Sender = > 'joe@(protected) ');
my $body .= "Message goes here. ";
my $mail = Mail::Internet- >new(Header = > $head,
Body = > [$body],
Modify = > 1,
);
my $success = $mail- >smtpsend(Host = > 'smtp.localhost.com ', Hello = > 'localhost.com ');
# EOF
================================================
--
Jason Dixon, RHCE
DixonGroup Consulting
http://www.dixongroup.net
--
redhat-list mailing list
unsubscribe mailto:redhat-list-request@(protected)?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list
|
|
 |