Mail::Sender problem

Discussion in 'Perl Misc' started by Merijn Boom, Feb 21, 2004.

  1. Merijn Boom

    Merijn Boom Guest

    Hi there,

    I'm trying to create an html mail with embedded pictures in it. I run perl
    on Windows and Red Hat but I cannot get your module (Mail::Sender) to work.


    I'm just trying to run the examples. Below this message you'll find the perl
    example I'm using and the header of the e-mail. What am I doing wrong?


    Regards



    Merijn Boom



    Perl code:



    use strict;

    use Mail::Sender;

    my $recipients = '';

    eval {

    (new Mail::Sender)

    ->OpenMultipart({



    to => 'mailto',

    FROM => 'mailfrom',

    subject => 'Alternatives with images',

    # debug => 'c:\temp\zkMailFlow.log',

    multipart => 'related',

    smtp => '127.0.0.1',

    })

    ->Part({ctype => 'multipart/alternative'})

    ->Part({ ctype => 'text/plain', disposition
    => 'NONE', msg => 'A long mail message.'})



    ->Part({ctype => 'text/html', disposition =>
    'NONE', msg => '<html><body><h1>A long</h1><p align=center>mail message.<img
    src="cid:img1"></p></body></html>'})



    ->EndPart("multipart/alternative")

    ->Attach({

    description => 'ed\'s GIF',

    ctype => 'image/GIF',

    encoding => 'base64',

    disposition => "inline;
    filename=\"apache_pb.gif\";\r\nContent-ID: <img1>",

    file => 'apache_pb.gif'

    })

    ->Close();

    } or print "Error sending mail: $Mail::Sender::Error\n";



    My Header:



    To: *

    From: *

    Subject: Alternatives with images

    Date: Sat, 21 Feb 2004 09:57:55 +0100

    X-Mailer: Perl script "Perl-1.pl"

    using Mail::Sender 0.8.10 by Jenda Krynicky, Czechlands

    running on medusa (10.1.0.133)

    under account "m.boom"

    Message-ID: <20040221_085755_005175.*>

    MIME-Version: 1.0

    Content-type: multipart/related;

    boundary="Message-Boundary-by-Mail-Sender-1077353872"

    Return-Path: *
    X-OriginalArrivalTime: 21 Feb 2004 08:58:38.0243 (UTC)
    FILETIME=[E52FC730:01C3F858]



    --Message-Boundary-by-Mail-Sender-1077353872

    Content-Type: multipart/alternative;
    boundary="Part-Message-Boundary-by-Mail-Sender-1077353872_2"



    --Part-Message-Boundary-by-Mail-Sender-1077353872_2

    Content-type: text/plain

    Content-transfer-encoding: 7BIT



    --Part-Message-Boundary-by-Mail-Sender-1077353872_2

    Content-type: image/GIF; name="apache_pb.gif"

    Content-description: ed's GIF

    Content-transfer-encoding: base64

    Content-disposition: inline; filename="apache_pb.gif";

    Content-ID: <img1>





    --Part-Message-Boundary-by-Mail-Sender-1077353872_2--



    --Message-Boundary-by-Mail-Sender-1077353872-



    My Message:



    A long mail message.--Part-Message-Boundary-by-Mail-Sender-1077353872_2

    Content-type: text/html

    Content-transfer-encoding: 7BIT



    <html><body><h1>A long</h1><p align=center>mail message.<img
    src="cid:img1"></p></body></html>--Part-Message-Boundary-by-Mail-Sender-1077
    353872_2--
     
    Merijn Boom, Feb 21, 2004
    #1
    1. Advertising

  2. Merijn Boom wrote:

    > Hi there,
    >
    > I'm trying to create an html mail with embedded pictures in it. I run perl
    > on Windows and Red Hat but I cannot get your module (Mail::Sender) to
    > work.


    Its not my module

    > I'm just trying to run the examples. Below this message you'll find the
    > perl example I'm using and the header of the e-mail. What am I doing
    > wrong?
    >
    >


    Try MIME::Lite instead.


    #!/usr/bin/perl
    use strict;

    require MIME::Lite;
    require MIME::Lite::HTML;


    my $msg;
    $msg = MIME::Lite->new(
    To =>'',
    From =>'',
    Subject =>'HTML with in-line images!',
    Type =>'multipart/related'
    );
    $msg->attach(Type => 'text/html',
    Data => qq{ <body>
    Here's <i>my</i> image:
    <img src="http://spam-me-please.com/images/spam.gif">
    </body> }
    );
    $msg->send;


    gtoomey
     
    Gregory Toomey, Feb 21, 2004
    #2
    1. Advertising

  3. Merijn Boom

    Merijn Boom Guest

    Gregory,

    Many thanks for your advice. I got it working now,

    Merijn

    "Gregory Toomey" <> wrote in message
    news:3246769.3fzmBbvPbA@GMT-hosting-and-pickle-farming...
    > Merijn Boom wrote:
    >
    > > Hi there,
    > >
    > > I'm trying to create an html mail with embedded pictures in it. I run

    perl
    > > on Windows and Red Hat but I cannot get your module (Mail::Sender) to
    > > work.

    >
    > Its not my module
    >
    > > I'm just trying to run the examples. Below this message you'll find the
    > > perl example I'm using and the header of the e-mail. What am I doing
    > > wrong?
    > >
    > >

    >
    > Try MIME::Lite instead.
    >
    >
    > #!/usr/bin/perl
    > use strict;
    >
    > require MIME::Lite;
    > require MIME::Lite::HTML;
    >
    >
    > my $msg;
    > $msg = MIME::Lite->new(
    > To =>'',
    > From =>'',
    > Subject =>'HTML with in-line images!',
    > Type =>'multipart/related'
    > );
    > $msg->attach(Type => 'text/html',
    > Data => qq{ <body>
    > Here's <i>my</i> image:
    > <img src="http://spam-me-please.com/images/spam.gif">
    > </body> }
    > );
    > $msg->send;
    >
    >
    > gtoomey
     
    Merijn Boom, Feb 21, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Showjumper
    Replies:
    2
    Views:
    1,856
    Showjumper
    Aug 2, 2003
  2. Dylan Parry
    Replies:
    2
    Views:
    587
  3. Replies:
    0
    Views:
    422
  4. Replies:
    0
    Views:
    380
  5. jodleren
    Replies:
    2
    Views:
    121
    Thomas 'PointedEars' Lahn
    Jan 31, 2008
Loading...

Share This Page