[H-GEN] Send html page via email in PERL??

Edwin Groothuis edwin at mavetju.org
Thu Mar 27 19:22:57 EST 2003


[ Humbug *General* list - semi-serious discussions about Humbug and     ]
[ Unix-related topics. Posts from non-subscribed addresses will vanish. ]

On Fri, Mar 28, 2003 at 09:57:14AM +1000, Tony Melia (DMS) wrote:
> I need to send a web page to an email address via PERL (Redhat 8).  I need
> functionality similar to IE6's 'send page via email' option which, given a
> URL, will send a html email message which consists on the web page at the
> URL, complete with images in a format identical to what would be seen on
> screen in a browser.  Is there any modules for doing this?  I can only see
> MIME related ones that rely on you knowing in advance what images e.t.c will
> be in the web page.

Try MIME::Lite

    #
    # Email
    #
    my $msg=MIME::Lite->new(
                To      => "$FULLNAME - fax <$EMAIL\@fax-processing>",
                From    => "Faxmaster <$FAXMASTER>",
                Subject => "Fax from $NICE_CALLER_ID to $NICE_CALLED_ID",
                Type    => 'multipart/related'
            );
    $msg->attach(
                Type    => 'text/html',
                Data    => join("\n", at lines)
            );
    $msg->attach(
                Type    => 'image/gif',
                Id      => '<logo150.gif>',
                Path    => '/usr/deskfax/etc/logo150.gif'
            );
    $msg->attach(
                Type    => 'application/pdf',
                Disposition => "attachment",
                Filename=> "fax-${NOWFILE}-${CALLER_ID}-${CALLED_ID}.pdf",
                Path    => "$DIR/$PDFFILE"
            );
    $msg->send();

@lines is the message send with it, for references to "external"
things (like the logo), use '<img src="cid:logo150.gif">'

Works fine in Mozilla, Netscape, Evolution, Outlook etc.

Edwin

-- 
Edwin Groothuis      |            Personal website: http://www.mavetju.org
edwin at mavetju.org    |    Weblog: http://www.mavetju.org/weblog/weblog.php 

--
* This is list (humbug) general handled by majordomo at lists.humbug.org.au .
* Postings to this list are only accepted from subscribed addresses of
* lists 'general' or 'general-post'.  See http://www.humbug.org.au/



More information about the General mailing list