Loading ...
Sorry, an error occurred while loading the content.

Re: [PBML] Problem with e-mail attachments

Expand Messages
  • Nathan.Jeffrey@dhs.vic.gov.au
    Firstly, when you re mucking around with odd output, I always like to turn on autoflush, so that I know that perl isn t trying to be too helpful with
    Message 1 of 1 , Oct 29, 2002
    • 0 Attachment
      Firstly, when you're mucking around with odd output, I always like to turn
      on autoflush, so that I know that perl isn't trying to be too helpful with
      buffering. I've had heaps of odd output problems cleared up using it.

      $|=1; # turn on autoflush

      Secondly, it's pretty much only the Windows mailers that understand native
      MIME type application/rtf. Have you thought about using something like
      MIME encoded mail attachments, which most mailers will understand? Not
      that I'm trying to change the way you'd like to do it, though.


      "Greg" <webmaster@...>
      30/10/2002 02:56 AM
      Please respond to perl-beginner

      To: perl-beginner@yahoogroups.com
      Subject: [PBML] Problem with e-mail attachments

      I have a script (portion below) that sends 3 .rtf files as e-mail
      attachments. Problem is, the files are received slightly corrupted,
      in that some of the rtf code ends up in the body text.

      e.g. !nstart1BMW Club Membership Application

      Code snippet:
      $app = "form.rtf";
      $memo = "memo.rtf";
      $article = "articles.rtf";
      $mailprog = "/usr/lib/sendmail";

      #--- Open & Read the files to be posted ---#
      $path = "$root/$app";
      open(FILEA,"$path") or &errortrap("Cannot open form:$!");
      @att1 = <FILEA>;
      close (FILEA);

      $path = "$root/$memo";
      open(FILEB,"$path") or &errortrap("Cannot open
      @att2 = <FILEB>;
      close (FILEB);

      $path = "$root/$article";
      open(FILEC,"$path") or &errortrap("Cannot open articles:$!");
      @att3 = <FILEC>;
      close (FILEC);

      #-- Now send e-mail --#
      $mailprog = "/usr/lib/sendmail";
      open(MAIL,"|$mailprog -t") or &errortrap("Could not send e-mail:
      print MAIL "To: $email\n";
      print MAIL "From: \"The BMW Club\"
      print MAIL "Subject: BMW Club membership application\n";
      print MAIL "MIME-Version: 1.0\n";
      print MAIL "Content-type: multipart/mixed;
      print MAIL "--bmwclubboundary\n";
      print MAIL "Content-type: text/plain; charset=us-ascii\n\n";
      print MAIL
      print MAIL " This message has been sent by an automatic
      system. \n";
      print MAIL " Please do not reply to it. No-one will read the reply.
      print MAIL
      print MAIL "Thank you for your request for a BMW Club
      membership application form.\n\n";
      print MAIL "The attached files are in Rich Text format, which you
      should be able to open in any version of MicroSoft Word, and
      most other word-processors.\n\n";
      print MAIL "Please print out and complete the form, then send to
      the address below with the appropriate fee.\n\n";
      print MAIL
      print MAIL "Send to: The BMW CLUB $section SECTION\n";
      print MAIL " $POST{$section}\n";
      print MAIL
      print MAIL "In case of any queries about this system, please
      contact the BMW Club webmaster
      print MAIL "The BMW Club is the trading name of The B.M.W.
      Motorcycle Club Ltd.\n";
      print MAIL "A company limited by guarantee. Registered in
      print MAIL "Registration Number 4261129. \n";
      print MAIL "Registered Office: Charter Court, Midland Road,
      Hemel Hempstead, Herts, HP2 5GE\n\n";
      print MAIL "--bmwclubboundary\n";
      print MAIL "Content-type: application/rtf \n";
      print MAIL "Content-Disposition: attachment;
      print MAIL "@att1\n\n";
      print MAIL "--bmwclubboundary\n";
      print MAIL "Content-type: application/rtf \n";
      print MAIL "Content-Disposition: attachment;
      print MAIL "@att2\n\n";
      print MAIL "--bmwclubboundary\n";
      print MAIL "Content-type: application/rtf \n";
      print MAIL "Content-Disposition: attachment;
      print MAIL "@att3\n\n";
      print MAIL "--bmwclubboundary--\n\n";
      close (MAIL);

      Unsubscribing info is here:

      Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/


      This email contains confidential information intended only for the person named above and may be subject to legal privilege. If you are not the intended recipient, any disclosure, copying or use of this information is prohibited. The Department provides no guarantee that this communication is free of virus or that it has not been intercepted or interfered with. If you have received this email in error or have any other concerns regarding its transmission, please notify Postmaster@...
    Your message has been successfully submitted and would be delivered to recipients shortly.