in reply to nntp posting (Moved from Q&A)

I would expect that MIME::Base64 would come in handy. The answer to this is probably similar to the answer to the question 'How do I attach a file to an e-mail', in which case you should hearken to some sort of MIME or Uuencode module to convert a binary file into something able to travel through the binary-unfriendly NNTP channels.

It appears from a brief perusal of the NNTPClient documentation that you will have to turn your plain HTML and images into one single message body and send that in your post() call.

Anyone who has more experience with this module or NNTP posting through Perl is welcome to correct me.

Replies are listed 'Best First'.
RE: Re: nntp posting (Moved from Q&A)
by Anonymous Monk on Oct 30, 2000 at 14:27 UTC
    #!/usr/bin/perl -w use News::NNTPClient; use MIME::Lite; $msg = MIME::Lite->new( To =>'news.directlink.net', Subject =>'HTML with in-line images!', Type =>'multipart/related' ); $msg->attach(Type => 'text/html', Data => qq{ <body> Here's <i>my</i> image: <img src="cid:myimage.gif"> </body> } ); $msg->attach(Type => 'image/gif', Id => 'myimage.gif', Path => '/usr/X11R6/share/IglooFTP/html/images +/viglooftp.gif', ); $c = new News::NNTPClient("news.bleh.com"); if ($c->postok()) { @header = ("Newsgroups: testing", "Subject: he234llo123", "From: test\ +@test.org"); @body = ("$msg"); $c->post(@header, "", @body); } __END__
    can't figure out what i'm doing wrong the posted output end sup a MIME::Lite=hashblehbleh
      You can't "stringify" a MIME::Lite object by simply referring to it in a string context. Your relevant line of code needs to be changed slightly:
      $body = $msg->as_string;
      Or use @body, whatever. Your post could also use some <code> tags, but I guess you can't fix it if you're not logged in.