in reply to plotting graphs

I've sort of been wondering how to include an image in email also. Can you just use an HTML image tag and load it from your web server? Or does every image have to actually be included in the email?

Replies are listed 'Best First'.
Re^2: plotting graphs
by zentara (Cardinal) on Apr 25, 2005 at 10:56 UTC
    You have to use "Id" and "cid:" tags to locate the image.
    #!/usr/bin/perl use MIME::Lite; my $from_address = 'selector@selectorweb.com'; my $to_address = 'selector@selectorweb.com'; my $subject = 'MIME test - HTML with image'; my $mime_type = 'multipart/related'; # Create the message headers my $mime_msg = MIME::Lite->new( From => $from_address, To => $to_address, Subject => $subject, Type => $mime_type ) or die "Error creating MIME body: $!\n"; # Attach the HTML content my $message_body = '<html><body><H3>Hello world! <img src="cid:myid.gif"></H3></body></html>'; $mime_msg->attach(Type => 'text/html', Data => $message_body); # Attach the image $mime_msg->attach( Type => 'image/gif', Id => 'myid.gif', Encoding => 'base64', Path => 'pikachu.jpg'); $mime_msg->send;

    I'm not really a human, but I play one on earth. flash japh
Re^2: plotting graphs
by jhourcle (Prior) on Apr 25, 2005 at 14:05 UTC

    For your own personal e-mail, you can send HTML formatting, and link to the images remotely. Because of spammers using 'web bugs' and the like to track if their e-mail was going through, many e-mail programs have options to not load images, so if you're sending it to other people, it may not be rendered as you might have hoped. If you're just sending images, and not trying to send a formatted message that includes images, just send them as a MIME attachment, and most modern e-mail readers will handle it.

    In the off chance that you are trying to send a richly formatted message that includes images, then follow zentara's directions. (I've never done it, but that looks like how some of the spam that I get is formatted)