in reply to MIME::Lite and Multipart
If you want to have text and html versions of the message then you should combine them in mutipart/alternative. If you want to add an attachment then you should create multipart/mixed which would contain multipart/alternative with text and html, and attachment. So message structure should be as follows:
Here's the small example that shows how to create such message:multipart/mixed - multipart/alternative - text/plain - text/html - application/pdf or whatever you want
use strict; use warnings; use MIME::Lite; my $alternative = MIME::Lite->new( Type => 'multipart/alternative', ); $alternative->attach( Type => 'TEXT', Data => 'Message text', ); $alternative->attach( Type => 'text/html', Data => '<p><b>Message text</b></p>', ); my $message = MIME::Lite->new( Type => 'multipart/mixed', From => 'sender@example.com', To => 'rcpt@example.com', Subject => 'Example', ); $message->attach($alternative); $message->attach( Type => 'TEXT', Filename => 'passwd', Disposition => 'attachment', Path => '/etc/passwd', ); $message->print(\*STDOUT);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: MIME::Lite and Multipart
by Analog (Novice) on Sep 29, 2009 at 21:20 UTC | |
by jakobi (Pilgrim) on Sep 29, 2009 at 21:49 UTC | |
by zwon (Abbot) on Sep 29, 2009 at 22:28 UTC | |
by jakobi (Pilgrim) on Sep 29, 2009 at 23:01 UTC | |
by zwon (Abbot) on Sep 29, 2009 at 22:43 UTC | |
by Analog (Novice) on Sep 29, 2009 at 23:29 UTC | |
by jakobi (Pilgrim) on Sep 30, 2009 at 00:08 UTC | |
|
Re^2: MIME::Lite and Multipart
by jakobi (Pilgrim) on Sep 29, 2009 at 19:53 UTC | |
by zwon (Abbot) on Sep 29, 2009 at 20:06 UTC | |
by jakobi (Pilgrim) on Sep 29, 2009 at 20:13 UTC |