Professional Web Applications Themes

When use MIME::Lite module the attachment clip sign not shown for attachments - PERL Modules

G'day. How can we show the attachment clip sign in receiver's inbox?. Currently the receiver actually receive the attchment, but it won't show up as a clip sign in Outlook/Outlook Express. Many people can't recognize the attachment, because it won't show up as a paper clip sign. use MIME::Lite::HTML; use MIME::Lite; my $mailHTML = new MIME::Lite::HTML From => "dlcoordinator\cs.org.au", To => "$receiver", Subject => "Solomon Islands leaflet attached"; my $MIMEmail = $mailHTML->p("file://C|/test/coverpage/coverexec.htm"); $MIMEmail->attach( Type => 'binary', Path =>'SolomonIs.leaflet.doc' , Filename => 'SolomonIs.leaflet.doc' , Disposition => 'attachment' ); $MIMEmail->send_by_smtp('sd.xdra.co.au'); Cheers Jo...

  1. #1

    Default When use MIME::Lite module the attachment clip sign not shown for attachments

    G'day. How can we show the attachment clip sign in receiver's inbox?.
    Currently the receiver actually receive the attchment, but it won't show up
    as a clip sign in Outlook/Outlook Express. Many people can't recognize the
    attachment, because it won't show up as a paper clip sign.

    use MIME::Lite::HTML;
    use MIME::Lite;

    my $mailHTML = new MIME::Lite::HTML
    From => "dlcoordinator\cs.org.au",
    To => "$receiver",
    Subject => "Solomon Islands leaflet attached";

    my $MIMEmail = $mailHTML->p("file://C|/test/coverpage/coverexec.htm");
    $MIMEmail->attach(
    Type => 'binary',
    Path =>'SolomonIs.leaflet.doc' ,
    Filename => 'SolomonIs.leaflet.doc' ,
    Disposition => 'attachment'

    );
    $MIMEmail->send_by_smtp('sd.xdra.co.au');



    Cheers

    Jo


    Jane Humbrey Guest

  2. #2

    Default When use MIME::Lite module the attachment clip sign not shown for attachments

    G'day. How can we show the attachment clip sign in receiver's inbox?.
    Currently the receiver actually receive the attchment, but it won't show up
    as a clip sign in Outlook/Outlook Express. Many people can't recognize the
    attachment, because it won't show up as a paper clip sign.

    use MIME::Lite::HTML;
    use MIME::Lite;

    my $mailHTML = new MIME::Lite::HTML
    From => "dlcoordinator\cs.org.au",
    To => "$receiver",
    Subject => "Solomon Islands leaflet attached";

    my $MIMEmail = $mailHTML->p("file://C|/test/coverpage/coverexec.htm");
    $MIMEmail->attach(
    Type => 'binary',
    Path =>'SolomonIs.leaflet.doc' ,
    Filename => 'SolomonIs.leaflet.doc' ,
    Disposition => 'attachment'

    );
    $MIMEmail->send_by_smtp('sd.xdra.co.au');



    Cheers

    Jo


    Jane Humbrey Guest

  3. #3

    Default Re: When use MIME::Lite module the attachment clip sign not shown for attachments

    Hi James

    I changed the type as you said, but the paper clip didn't appear to show the
    attachments in Outlook/Outlook Express : (.

    Jo
    "James Willmore" <jwillmorecyberia.com> wrote in message
    news:e0160815.0308262232.29f48582posting.google.c om...
    > "Jane Humbrey" <janehumbreyhotmail.com> wrote in message
    news:<ZjT2b.128239$JA5.3010567news.xtra.co.nz>...
    > > G'day. How can we show the attachment clip sign in receiver's inbox?.
    > > Currently the receiver actually receive the attchment, but it won't show
    up
    > > as a clip sign in Outlook/Outlook Express. Many people can't recognize
    the
    > > attachment, because it won't show up as a paper clip sign.
    > >
    > > use MIME::Lite::HTML;
    > > use MIME::Lite;
    > >
    > > my $mailHTML = new MIME::Lite::HTML
    > > From => "dlcoordinator\cs.org.au",
    > > To => "$receiver",
    > > Subject => "Solomon Islands leaflet attached";
    > >
    > > my $MIMEmail =
    $mailHTML->p("file://C|/test/coverpage/coverexec.htm");
    > > $MIMEmail->attach(
    > > Type => 'binary',
    > > Path =>'SolomonIs.leaflet.doc' ,
    > > Filename => 'SolomonIs.leaflet.doc' ,
    > > Disposition => 'attachment'
    > >
    > > );
    > > $MIMEmail->send_by_smtp('sd.xdra.co.au');
    >
    > Change your 'Type' to 'application/msword'. Because it's 'binary',
    > it's going to look like, well, a binary file to the email client.
    > Since the module is MIME::Lite, it's going to 'assign' a MIME type to
    > your file - based upon RFC-2046 for MIME messages. If this were, say,
    > a CSV file that you wanted users to open with Excel, the 'Type' would
    > be 'application/vnd.ms-excel'.
    >
    > I did something like this using just MIME::Lite. I changed the MIME
    > type to show the attachment as an Excel file - but it was really a CSV
    > file with an xls extention. It worked great.
    >
    > HTH
    >
    > Jim

    Jane Humbrey Guest

  4. #4

    Default Re: When use MIME::Lite module the attachment clip sign not shown for attachments

    "Jane Humbrey" <janehumbreyhotmail.com> wrote in message news:<KY93b.129228$JA5.3037479news.xtra.co.nz>...
    > Hi James
    >
    > I changed the type as you said, but the paper clip didn't appear to show the
    > attachments in Outlook/Outlook Express : (.
    >
    > Jo
    Okay ... I wanted to do something similar ... and normally, I don't do
    this, but .... here is some code for you to try.

    First, change the directory to what you are using, and fill in valid
    'To' and 'From' address, and change the SMTP server from 'localhost'
    to what you normally use/need to use.

    Second, I used Novell GroupWise and Sylpheed as the email clients. As
    stated in the MIME::Lite and MIME::Lite::HTML doentation and proven
    during my tests, each client will handle email attachments
    differently. Plus, you will notice I tried to add text to the
    begining of the email - which was the only thing that showed properly
    in the email clients. So, I commented the lines out. The code will
    produce inline HTML AND attachments. However, I was not able to test
    using Outlook.

    I personally want to get this working properly, because I would like
    to use this in work I do. I'll post anything else I know here -and- I
    might just email the author to see if the usage is correct -and-
    double check the RFC's to see if the output produced and what the
    RFC's jive. So far, they do.

    I didn't use the MIME::Lite::HTML module because that only produces
    inline HTML. From the OP, it appears that you wanted an attachment.
    I also used LWP and HTML::TokeP to gather the original doent.
    The code is commented for you (and any one else's) review.

    HTH

    Jim

    ==TESTED, BUT NEEDS VARIABLES UPDATED==
    #!/usr/bin/perl -w

    #use strict pragma
    use strict;

    #use the following modules
    use LWP::Simple;
    use HTML::TokePr;
    use MIME::Lite;

    #declare lexical variables (I do it right Tad? :) )
    my ($directory,$text,$html,$pr,%images,$mimeLite) ;

    #what directory are file files located
    $directory = '<fill in directory here>';

    #set the text (aka body) of message
    $text = 'Here is the latest add for ....';

    #get the HTML doent (as if you were using a browser) using LWP
    #notice the 'file://' - this is the same as if you typed in
    #file:///<some directory>/<some file>
    $html = get("file://$directory/index.htm");

    #declare a new HTML::TokePr object - use the HTML file
    #you just got as the doent to p
    $pr = HTML::TokePr->new(\$html);

    #while parsing through the doent, get each token
    #(aka tag w/ attributes)
    while (my $token = $pr->get_token) {
    #if the tag is a start tag AND is the 'img' tag ....
    if ($token->[0] eq 'S' && $token->[1] eq 'img') {
    #store the 'src' attribute (aka the image file name)
    #in the hash %images
    $images{ $token->[2]{'src'} }++;
    }
    }

    #this will allow MIME::Lite to verify the address you're sending to
    $MIME::Lite::AUTO_VERIFY=1;

    #create a new MIME::Lite object with
    #the following attributes
    #The 'Reply-To' is NOT required, but nice in case this script
    #runs as a daemon/service - if you set this, when a user
    #clicks the 'Reply', the 'Reply-To' address is used instead of
    #the 'From' address
    $mimeLite = new MIME::Lite(
    From=>'FROM',
    To=>'TO',
    Subject=>'TEST',
    Type=>'multipart/related',
    'Reply-To'=>'RELPY-TO',
    );

    #THIS PART DOES NOT WORK PROPERLY
    #Now, start building your MIME encoded attachments
    #First, attach the body ...
    #$mimeLite->attach(
    # Type=>'text/plain',
    # Data=>"$text",
    # Encoding=>'quoted-printable'
    #);

    #now, the images ...
    foreach my $img(keys %images){
    #now, put $img into $new_img
    my $new_img = $img;
    #this regex removes the leading '/' from the filename
    #it may NOT be required - it was for my test ;)
    $new_img =~ s/^\///;

    #get rid of any path information - just get the filename
    $new_img =~ s/^.*[\/](\w+\.\w+)$/$1/;

    #according to the MIME::Lite doentation, in order to get
    #any images to show up, we need to insert 'cid:' into the
    'src'
    #tag - we'll to that here for each image with a regex
    $html =~ s/\"$img\"/\"cid:$new_img\"/g;

    #now create the attachment ...
    $mimeLite->attach(
    Type=>'image/gif',
    Path=>"$directory/$img",
    Id=>"$new_img",
    Encoding=>'base64',
    Disposition=>'attachment',
    Filename=>"$new_img"
    );
    }

    #now, attach the HTML file ...
    #for your purposes, you may want to change the 'Type' to
    #what was suggested in the previous post and the 'Encoding'
    #could be removed if you do that or changed to
    #'base64'
    $mimeLite->attach(
    Type=>'text/html',
    Data=>"$html",
    Encoding=>'quoted-printable',
    Disposition=>'attachment',
    Filename=>'myhtml.htm'
    );

    #send the message
    $mimeLite->send('smtp', 'localhost');
    James Willmore Guest

  5. #5

    Default Re: When use MIME::Lite module the attachment clip sign not shown for attachments

    "Jane Humbrey" <janehumbreyhotmail.com> wrote in message
    news:ZjT2b.128239$JA5.3010567news.xtra.co.nz...
    > G'day. How can we show the attachment clip sign in receiver's inbox?.
    > Currently the receiver actually receive the attchment, but it won't show
    up
    > as a clip sign in Outlook/Outlook Express. Many people can't recognize the
    > attachment, because it won't show up as a paper clip sign.
    Your problem does not appear to be a Perl problem.

    You should get the receiver to do this: In Outlook Express, do "View +
    Columns" and check the Attachment Checkbox. Then move the Attachment Column
    (Checkbox) to the position (order) he/she desires.

    If the Attachment Checkbox is not selected at the client end, why would you
    expect the receiver to be able to see the paper clip symbol?

    Bill Segraves


    William Alexander Segraves Guest

  6. #6

    Default Re: When use MIME::Lite module the attachment clip sign not shown for attachments

    "Jane Humbrey" <janehumbreyhotmail.com> wrote in message news:<85x3b.130648$JA5.3080006news.xtra.co.nz>...
    > Hi James
    >
    > Thanks for your code. I changed all details as you said. The script was run
    > OK. But the output was an email with all were attachments(html file,image
    > file, word file). The paper clip didn't show up in the Outlook/Outlook
    > Express. I really want the html and the image should be in the message in
    > correct places. I want to attach only a word file as attachment and the
    > paper clip sign to be shown in the receiver's inbox. Thank you once again
    > for your help.
    >
    > Cheers
    > Jo
    Bill Segraves posted a suggestion as well - maybe you should give that
    a shot and see what happens. I'm begining to believe as Bill does
    that this is not a Perl issue. If the MIME encoding is correct
    (which, as far as I can tell from the code I posted previously is),
    that the issue resides with the usage of the email client. Sorry :(

    Jim
    James Willmore Guest

Similar Threads

  1. Having trouble installing MIME::Lite module
    By macik81@hotmail.com in forum PERL Modules
    Replies: 2
    Last Post: July 7th, 02:51 AM
  2. Replies: 1
    Last Post: November 12th, 08:31 PM
  3. MIME::Lite - Please guide me
    By John B. Kim in forum PERL Modules
    Replies: 9
    Last Post: November 16th, 10:39 PM
  4. Replies: 1
    Last Post: September 1st, 12:23 AM
  5. MIME::Lite html-attachment broken
    By news@roaima.freeserve.co.uk in forum PERL Modules
    Replies: 0
    Last Post: July 4th, 01:37 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139