Professional Web Applications Themes

Mime Lite attachments - PERL Beginners

All, Was hoping for some advise b/c I cannot seem to get this to work. My problem is that it attaches the path name when I need to actual data attached. So my goal is as if it would be cat test |uuencode test | mailx -s test com thanks, my $scratchtps = "/usr/local/log/filename"; code snippet < there is a process that may/may not populate this file.  if ( -s $scratchtps ) { &mailme; } sub mailme { my $msg = MIME::Lite->new( From => 'EDM01 <ohnet>', To => 'Derek Smith <com>', Subject => "Return EDM Tapes", Type => 'TEXT', Data ...

  1. #1

    Default Mime Lite attachments

    All,

    Was hoping for some advise b/c I cannot seem to get this to work.
    My problem is that it attaches the path name when I need to actual data
    attached. So my goal is as if it would be

    cat test |uuencode test | mailx -s test com

    thanks,

    my $scratchtps = "/usr/local/log/filename";

    code snippet <
    there is a process that may/may not populate this file. 



    if ( -s $scratchtps ) {
    &mailme;
    }

    sub mailme {
    my $msg = MIME::Lite->new(
    From => 'EDM01 <ohnet>',
    To => 'Derek Smith <com>',
    Subject => "Return EDM Tapes",
    Type => 'TEXT',
    Data => "$scratchtps",
    Disposition => 'attachment');
    $msg->send;
    }




    DBSMITH@OhioHealth.com Guest

  2. #2

    Default Re: Mime Lite attachments


    >
    >
    >
    > if ( -s $scratchtps ) {
    > &mailme;[/ref]

    The above is usually better written as:

    mailme();
     

    'Data' is for the body, you need to either use the separate C<attach>
    method, or provide the filename as the 'Path' argument.

    You really should start reading the docs thoroughly, you have asked a
    number of questions that are pretty simple if you just pay attention to
    the API, and MIME::Lite has very thorough and simple doentation,

    http://search.cpan.org/~yves/MIME-Lite-3.01/lib/MIME/Lite.pm#Create_a_simple_message_containing_just_an _image

     

    http://danconia.org
    Wiggins Guest

  3. #3

    Default Re: Mime Lite attachments

    Hello everybody,

    I have used something like this to send e-mail with three parts: one is an
    html code that internally refers to other two files to compose the final
    design. This code may be adaptable to other needs.

    May be this help somebody.

    Josimar Nunes de Oliveira


    ==========================

    $msg = MIME::Lite->new(
    From => $from_id,
    To => $to_id,
    Cc => $cc_id,
    Subject => $subject_text,
    Type => 'multipart/related',
    );

    my $var = '<html>....<body>....
    <table border="1"
    background="cid:InternalFileNameA.gif">...
    ....
    ....<img src="cid:InternalFileNameB.jpg">....
    ....
    </body></html>';

    $msg->attach(
    Type => 'text/html',
    Data => $var
    );

    $msg->attach(
    Type => 'image/gif',
    Id => 'InternalFileNameA.gif',
    Path => 'FileNameA.gif'
    );

    $msg->attach(
    Type => 'image/jpeg',
    Id => 'InternalFileNameB.jpg',
    Path => 'FileNameB.jpg'
    );

    ==========================

    ----- Original Message -----
    From: "Wiggins d Anconia" <org>
    To: <com>; <org>
    Sent: Tuesday, September 21, 2004 10:33 AM
    Subject: Re: Mime Lite attachments

     
    >
    >
    >
    > if ( -s $scratchtps ) {
    > &mailme;[/ref]

    The above is usually better written as:

    mailme();
     

    'Data' is for the body, you need to either use the separate C<attach>
    method, or provide the filename as the 'Path' argument.

    You really should start reading the docs thoroughly, you have asked a
    number of questions that are pretty simple if you just pay attention to
    the API, and MIME::Lite has very thorough and simple doentation,

    http://search.cpan.org/~yves/MIME-Lite-3.01/lib/MIME/Lite.pm#Create_a_simple_message_containing_just_an _image

     

    http://danconia.org

    --
    To unsubscribe, e-mail: org
    For additional commands, e-mail: org
    <http://learn.perl.org/> <http://learn.perl.org/first-response>





    Josimar Guest

  4. #4

    Default Re: Mime Lite attachments

    This works great, thnaks!

    I was missing the $msg->attach(
    Type => 'image/gif',
    Id => 'InternalFileNameA.gif',
    Path => 'FileNameA.gif'
    );
    block. Prior I was doing this in one full swoop.

    derek





    "Josimar Nunes de Oliveira" <com.br>
    09/21/2004 01:10 PM


    To: "Wiggins d Anconia" <org>, <com>,
    <org>
    cc:
    Subject: Re: Mime Lite attachments


    Hello everybody,

    I have used something like this to send e-mail with three parts: one is an
    html code that internally refers to other two files to compose the final
    design. This code may be adaptable to other needs.

    May be this help somebody.

    Josimar Nunes de Oliveira


    ==========================

    $msg = MIME::Lite->new(
    From => $from_id,
    To => $to_id,
    Cc => $cc_id,
    Subject => $subject_text,
    Type => 'multipart/related',
    );

    my $var = '<html>....<body>....
    <table border="1"
    background="cid:InternalFileNameA.gif">...
    ....
    ....<img src="cid:InternalFileNameB.jpg">....
    ....
    </body></html>';

    $msg->attach(
    Type => 'text/html',
    Data => $var
    );

    $msg->attach(
    Type => 'image/gif',
    Id => 'InternalFileNameA.gif',
    Path => 'FileNameA.gif'
    );

    $msg->attach(
    Type => 'image/jpeg',
    Id => 'InternalFileNameB.jpg',
    Path => 'FileNameB.jpg'
    );

    ==========================

    ----- Original Message -----
    From: "Wiggins d Anconia" <org>
    To: <com>; <org>
    Sent: Tuesday, September 21, 2004 10:33 AM
    Subject: Re: Mime Lite attachments

     
    >
    >
    >
    > if ( -s $scratchtps ) {
    > &mailme;[/ref]

    The above is usually better written as:

    mailme();
     
    <com>', 

    'Data' is for the body, you need to either use the separate C<attach>
    method, or provide the filename as the 'Path' argument.

    You really should start reading the docs thoroughly, you have asked a
    number of questions that are pretty simple if you just pay attention to
    the API, and MIME::Lite has very thorough and simple doentation,

    http://search.cpan.org/~yves/MIME-Lite-3.01/lib/MIME/Lite.pm#Create_a_simple_message_containing_just_an _image

     

    http://danconia.org

    --
    To unsubscribe, e-mail: org
    For additional commands, e-mail: org
    <http://learn.perl.org/> <http://learn.perl.org/first-response>








    DBSMITH@OhioHealth.com Guest

Similar Threads

  1. Using MIME::Lite to send mail/or attachments
    By Jason in forum PERL Beginners
    Replies: 2
    Last Post: June 24th, 01:30 PM
  2. mime lite
    By DBSMITH@OhioHealth.com in forum PERL Beginners
    Replies: 4
    Last Post: June 4th, 09:09 PM
  3. MIME::Lite 3.01 in CGI script doing nothing
    By David Christensen in forum PERL Modules
    Replies: 0
    Last Post: February 27th, 02:18 AM
  4. Replies: 1
    Last Post: September 1st, 12:23 AM
  5. Replies: 5
    Last Post: August 30th, 01:56 AM

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