Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

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 email@email.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 <root@edm01.ohnet>',
To      => 'Derek Smith <dbsmith@ohiohealth.com>',
Subject => "Return EDM Tapes",
Type    => 'TEXT',
Data     => "$scratchtps",
Disposition => 'attachment');
$msg->send;
}





Report this thread to moderator Post Follow-up to this message
Old Post
DBSMITH@OhioHealth.com
09-22-04 08:57 PM


Re: 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 email@email.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;

The above is usually better written as:

mailme();

>                         }
>
>         sub mailme {
>                         my $msg = MIME::Lite->new(
>                         From    => 'EDM01 <root@edm01.ohnet>',
>                         To      => 'Derek Smith <dbsmith@ohiohealth.com>',
>                         Subject => "Return EDM Tapes",
>                         Type    => 'TEXT',
>                         Data     => "$scratchtps",

'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 documentation,

http://search.cpan.org/~yves/MIME-L...g_just_an_image


>                         Disposition => 'attachment');
>                         $msg->send;
>         }
>

http://danconia.org

Report this thread to moderator Post Follow-up to this message
Old Post
Wiggins d Anconia
09-22-04 08:57 PM


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" <wiggins@danconia.org>
To: <DBSMITH@OhioHealth.com>; <beginners@perl.org>
Sent: Tuesday, September 21, 2004 10:33 AM
Subject: Re: 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 email@email.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;

The above is usually better written as:

mailme();

>                         }
>
>         sub mailme {
>                         my $msg = MIME::Lite->new(
>                         From    => 'EDM01 <root@edm01.ohnet>',
>                         To      => 'Derek Smith <dbsmith@ohiohealth.com>',
>                         Subject => "Return EDM Tapes",
>                         Type    => 'TEXT',
>                         Data     => "$scratchtps",

'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 documentation,

http://search.cpan.org/~yves/MIME-L...g_just_an_image


>                         Disposition => 'attachment');
>                         $msg->send;
>         }
>

http://danconia.org

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






Report this thread to moderator Post Follow-up to this message
Old Post
Josimar Nunes de Oliveira
09-22-04 08:57 PM


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" <jn_oliveira@directnet.com.br>
09/21/2004 01:10 PM


To:     "Wiggins d Anconia" <wiggins@danconia.org>, <DBSMITH@OhioHealth.com>
,
<beginners@perl.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" <wiggins@danconia.org>
To: <DBSMITH@OhioHealth.com>; <beginners@perl.org>
Sent: Tuesday, September 21, 2004 10:33 AM
Subject: Re: 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 email@email.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;

The above is usually better written as:

mailme();

>                         }
>
>         sub mailme {
>                         my $msg = MIME::Lite->new(
>                         From    => 'EDM01 <root@edm01.ohnet>',
>                         To      => 'Derek Smith
<dbsmith@ohiohealth.com>',
>                         Subject => "Return EDM Tapes",
>                         Type    => 'TEXT',
>                         Data     => "$scratchtps",

'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 documentation,

http://search.cpan.org/~yves/MIME-L...g_just_an_image


>                         Disposition => 'attachment');
>                         $msg->send;
>         }
>

http://danconia.org

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









Report this thread to moderator Post Follow-up to this message
Old Post
DBSMITH@OhioHealth.com
09-22-04 08:57 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PERL Beginners archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:17 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.