CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: General Discussions: General Questions:
Access binary data from http

 



saaam03
New User

Jun 10, 2009, 10:51 AM

Post #1 of 5 (5111 views)
Access binary data from http Can't Post

I have a .NET application which make a zip file and send it
to PERL script in binary stream through http, i have to attach that zip file and email to a specified address. but i am unable to attach that file.

can anybody help me ... its very urgent.


KevinR
Veteran


Jun 10, 2009, 11:56 AM

Post #2 of 5 (5109 views)
Re: [saaam03] Access binary data from http [In reply to] Can't Post

If you are using perl to send the email, look into getting MIME::Lite installed and using it to send the attached file.
-------------------------------------------------


saaam03
New User

Jun 10, 2009, 10:20 PM

Post #3 of 5 (5104 views)
Re: [KevinR] Access binary data from http [In reply to] Can't Post

Actually i m unable to process that binary data ... dont have any problem with mail.


FishMonger
Veteran / Moderator

Jun 11, 2009, 7:01 AM

Post #4 of 5 (5096 views)
Re: [saaam03] Access binary data from http [In reply to] Can't Post

Show us what you've tried.


saaam03
New User

Jun 11, 2009, 9:42 AM

Post #5 of 5 (5093 views)
Re: [FishMonger] Access binary data from http [In reply to] Can't Post

use core qw ( CGI_USER ) ;
use utils::MailMime;
$core::dbh->ensureWebAlive();
my $osysconfig = sysconfig->new({MINIMAL => '1'});
use Archive::Zip qw( :ERROR_CODES :CONSTANTS );

my $params = CGI::Vars();
use Archive::Zip qw( :ERROR_CODES );
#print "Content-type:text/html\n\n";
print header;

my $MAILTO = 'abc@xyz.net';


my $MAILFROM = 'abc@xyz.net';

my $smtp = $osysconfig->GetSMTPServer();
my $port = $osysconfig->GetSMTPServerPort();
my $host = hostname();
my $omailer = MailMime->new( { SMTPSERVER=> $smtp, SMTPSERVERPORT => $port } );

# $$params{LOG} ---- this is the binary zipped file which i have to attached with email.
if (($$params{LOG}) and (not $$params{REMOTEFILE}))
{
$file = '/tmp/tmp.zip' ;
#use Archive::Zip;

#my $zip = new Archive::Zip;

#my $data = "$$params{LOG}";

#$zip->addString($data,"LOG");
#$zip->writeToFileNamed($$params{LOG});
#print FILE $$params{LOG};
#close FILE;

#give read write permission to all
#`chmod 666 $file`;
my $fh;
#open ( $fh , '>', $file ) or $core::logger->Die( 'Error opening file', $@);

#print $fh "$$params{LOG}";
#if (defined $$params{LOG});
#print $fh $$params{SCREENSHOT}
#if (defined $$params{SCREENSHOT});
close $fh;

}

my $text = "Application logs are attached\n\nDetails of the sender:\n\nLogin:$$params{LOGIN} \nServer Address: $host";
$text .= "\n\n$$params{USERTEXT}" if ( $$params{USERTEXT} );
my %Ret;

if (($$params{LOG}) and (not $$params{REMOTEFILE}))
{
eval
{
%Ret = $omailer->SendFile({

From => $MAILFROM,
To => $MAILTO,
Subject => "Application Report from $$params{LOGIN} on $host",
Text => $text ,
Path => $file,
Type => 'binary'
}) or die "Could not send mail [$!]";
};
}
if ( $@ )
{
print "$@\n";
}
else
{
print "1";
}


what i have tried is commented code.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives