Sending files via e-mail - please help. 
Author Message
 Sending files via e-mail - please help.

Hello!

I would like to send a binary file via e-mail (with sendmail). How to do
it? I have some code (the subroutine which is sending the files is
below) in Perl but it is not working. All permissions and stuff like
that are set correctly. I think that with the code is something wrong.
Please help.

--Start--
open(MAIL,"|$mailprog -t");

print MAIL "To: $email ($realname)\n";
print MAIL "From: $fromaddr ($fromname)\n";
if ($organization) {
   print MAIL "Organization: $organization\n";

Quote:
}

else {
   print MAIL "Organization: Auto sent file\n";
Quote:
}

print MAIL "Subject: $file\n";
print MAIL "X-Courtesy-Of: SendIt! 1.0\n\n";
open(INPUT,"$filebase/$file")||&error;
while (<INPUT>) {
   chop $_;
   print MAIL $_,"\n";
Quote:
}

close (INPUT);
close (MAIL);
--End--
--
Marek Wawoczny
Serwis Internetowy Kaboom
 WWW: http://www.*-*-*.com/
 FTP: ftp://ftp.kaboom.gdynia.top.pl

 ICQ UIN: 5292063


Thu, 26 Jul 2001 03:00:00 GMT  
 Sending files via e-mail - please help.

Quote:
>Hello!

Howdy.

Quote:
>I would like to send a binary file via e-mail (with sendmail). How to do
>it?

How do you usually do it? Most folks uuencode or MIME encode the binary
file.

Quote:
>I have some code (the subroutine which is sending the files is
>below) in Perl but it is not working. All permissions and stuff like
>that are set correctly. I think that with the code is something wrong.
>Please help.

You can't send binary file in Email messages -- The binary file must be
encoded first. You didn't encode the file.

Quote:
>--Start--
>open(MAIL,"|$mailprog -t");
>print MAIL "To: $email ($realname)\n";
>print MAIL "From: $fromaddr ($fromname)\n";
>if ($organization) {
>   print MAIL "Organization: $organization\n";
>}
>else {
>   print MAIL "Organization: Auto sent file\n";
>}
>print MAIL "Subject: $file\n";
>print MAIL "X-Courtesy-Of: SendIt! 1.0\n\n";
>open(INPUT,"$filebase/$file")||&error;
>while (<INPUT>) {
>   chop $_;
>   print MAIL $_,"\n";
>}
>close (INPUT);
>close (MAIL);
>--End--

Take a look at:

    http://reference.perl.com/query.cgi?mail

and use something like MIME::Lite

--
Clay Irving



Thu, 26 Jul 2001 03:00:00 GMT  
 Sending files via e-mail - please help.
I have written a free script which does basically what you want, I
suggest having a look at it (or installing it and then hacking it to
suit your needs :)

http://scripts.marschall.net/

The script is called mail-select

All the best,
-Paul

Quote:

> Hello!

> I would like to send a binary file via e-mail (with sendmail). How to do
> it? I have some code (the subroutine which is sending the files is
> below) in Perl but it is not working. All permissions and stuff like
> that are set correctly. I think that with the code is something wrong.
> Please help.

> --Start--
> open(MAIL,"|$mailprog -t");

> print MAIL "To: $email ($realname)\n";
> print MAIL "From: $fromaddr ($fromname)\n";
> if ($organization) {
>    print MAIL "Organization: $organization\n";
> }
> else {
>    print MAIL "Organization: Auto sent file\n";
> }
> print MAIL "Subject: $file\n";
> print MAIL "X-Courtesy-Of: SendIt! 1.0\n\n";
> open(INPUT,"$filebase/$file")||&error;
> while (<INPUT>) {
>    chop $_;
>    print MAIL $_,"\n";
> }
> close (INPUT);
> close (MAIL);
> --End--
> --
> Marek Wawoczny
> Serwis Internetowy Kaboom
>  WWW: http://www.kaboom.gdynia.top.pl
>  FTP: ftp://ftp.kaboom.gdynia.top.pl

>  ICQ UIN: 5292063



Thu, 26 Jul 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Sending files via e-mail - please help.

2. Automatic send file via email

3. Automatic send file via email

4. Automatic send file via email

5. attachments (MIME encode a gif file and send via email)

6. Sending mail via cgi/perl with a file attached to it

7. Sending files via mail in perl

8. Help sending e-mail via Perl script

9. search .pl file, where I can send email for Win32 over GMX-Mail Gateway

10. newbe help please sending arguments to a cgi script via ssi

11. please help ... sending attachments via pop3 and perl

12. search .pl file, where I can send email for Win32 over GMX-Mail Gateway

 

 
Powered by phpBB® Forum Software