Script sends mail, only get header!! 
Author Message
 Script sends mail, only get header!!

I have a perl script which mails an output file to my account on
another Unix box.  Here are the two commands I have tried:



Both commands give me the same problem.  When I read my mail on
unix.com, I only get the header of the message... there is no body.

If I run the command from the shell, everything works just fine.  Any
ideas Perl/Unix gurus????

-Dean

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Wed, 18 Jun 1902 08:00:00 GMT  
 Script sends mail, only get header!!
On Fri, 06 Oct 2000 23:35:03 GMT,

Quote:
> I have a perl script which mails an output file to my account on
> another Unix box.  Here are the two commands I have tried:




Why are you treating Perl as a shell script language? There are many
modules out there that can do this for you.

Have you thought about what happens if

$outfile = '; rm -rf /;';

? Do you know what happens now? Why are you using cat? Why are you using
mailx, which is not available on that many systems? Have you read the
perl FAQ?

# perldoc -q 'send.*mail'
Found in /opt/perl/lib/5.6.0/pod/perlfaq9.pod
       How do I send mail?
[SNIP]

Quote:
> If I run the command from the shell, everything works just fine.  Any
> ideas Perl/Unix gurus????

Yep. Don't use cat unnecessarily. If you must use mailx, read its manual
page. But... Don't use mailx. If you must directly use an external
program, use sendmail (and realise that sendmail may not be in the
user's path). But, to avoid making silly mistakes, just use one of the
modules from CPAN

http://search.cpan.org/
http://www.cpan.org/

Oh, and READ this group before you post. The question 'ho do I send
email' comes up at least once a week here. It's probably the most FAQ
there is. Almost.

Martien
--
Martien Verbruggen              |
Interactive Media Division      |
Commercial Dynamics Pty. Ltd.   | Curiouser and curiouser, said Alice.
NSW, Australia                  |



Wed, 26 Mar 2003 09:29:06 GMT  
 Script sends mail, only get header!!

Quote:

> On Fri, 06 Oct 2000 23:35:03 GMT,

> > I have a perl script which mails an output file to my account on
> > another Unix box.  Here are the two commands I have tried:



> Why are you treating Perl as a shell script language? There are many
> modules out there that can do this for you.

The email command is just the last function of a much larger script.  I
don't think using another module is prudent in this case...

Quote:

> Have you thought about what happens if

> $outfile = '; rm -rf /;';

> ? Do you know what happens now? Why are you using cat? Why are you
using
> mailx, which is not available on that many systems? Have you read the
> perl FAQ?

I can appreciate your position on this, but my script is only going to
run on HP Unix servers.  I don't really care about any other
platforms...
Quote:

> # perldoc -q 'send.*mail'
> Found in /opt/perl/lib/5.6.0/pod/perlfaq9.pod
>        How do I send mail?
> [SNIP]

I'll definitely check the faq for future ideas.

Quote:
> > If I run the command from the shell, everything works just fine.
Any
> > ideas Perl/Unix gurus????

> Yep. Don't use cat unnecessarily. If you must use mailx, read its
manual
> page. But... Don't use mailx. If you must directly use an external
> program, use sendmail (and realise that sendmail may not be in the
> user's path). But, to avoid making silly mistakes, just use one of the
> modules from CPAN

Actually, a friend of mine came up with the solution.  My problem was
caused by not closing the filehandle for the output file.  Doh!!  Of
course it's impossible to mail the file if it is still open...  live
and learn!

Quote:

> http://search.cpan.org/
> http://www.cpan.org/

> Oh, and READ this group before you post. The question 'ho do I send
> email' comes up at least once a week here. It's probably the most FAQ
> there is. Almost.

> Martien
> --
> Martien Verbruggen              |
> Interactive Media Division      |
> Commercial Dynamics Pty. Ltd.   | Curiouser and curiouser, said Alice.
> NSW, Australia                  |

Thanks for taking the time to point me in the right direction Martien.

-Dean

Sent via Deja.com http://www.deja.com/
Before you buy.



Wed, 18 Jun 1902 08:00:00 GMT  
 Script sends mail, only get header!!
On Sat, 07 Oct 2000 15:38:43 GMT, Dean J. Pompilio

Quote:



>> On Fri, 06 Oct 2000 23:35:03 GMT,

>> > I have a perl script which mails an output file to my account on
>> > another Unix box.  Here are the two commands I have tried:



>> Why are you treating Perl as a shell script language? There are many
>> modules out there that can do this for you.

>The email command is just the last function of a much larger script.  I
>don't think using another module is prudent in this case...

Try reading this
http://www.franken.de/users/lisa/horshack/perl/index.html#mail

Should work for you. Mailing is an often used function, it's worth you
write a little wrapper-module which you use only on your systems.

Greetings from Bavaria, Germany
Horshack



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. getting mail header from entering mail

2. Mail::Send module and Reply-To header

3. subject header problem when sending mail (Net:smtp and sendmail)

4. Mail::Send header tags?

5. Mail::Send not setting From header

6. Mail::Send and the from header

7. Mail::Send not setting From header

8. Mail::Send Headers

9. Mail::Send module and Reply-To header

10. Sending mail under Cygwin using Mail::Send perl module

11. Getting Started with Perl/CGI - Sending Mail

12. HTTP::Headers - getting request headers

 

 
Powered by phpBB® Forum Software