Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Sending email

How do I send Mime attachments? by MikeLacey
Posted: 1 Jul 02 (Edited 23 Dec 02)

Please browse through FAQ219-2884 and FAQ219-2889 first. Comments on this FAQ and the General FAQ are very welcome.

use MIME::Lite;

### Create a new multipart message:
$msg = MIME::Lite->new(
  From    =>'me@myhost.com',
  To      =>'you@yourhost.com',
  Cc      =>'some@other.com, some@more.com',
  Subject =>'A message with 2 parts...',
  Type    =>'multipart/mixed'

### Add parts (each "attach" has same arguments as "new"):
  Type     =>'TEXT',
  Data     =>"Here's the GIF file you wanted"
  Type     =>'image/gif',
  Path     =>'/usr/local/tmp/aaa000123.gif',
  Filename =>'logo.gif'

$text = $msg->as_string;

## MIME::Lite also includes a method for sending these
## things.


The "Path" attribute is the full path to the file you are sending.

The "Filename" attribute is the filename that will be displayed to the person who receives the email.

Back to Perl FAQ Index
Back to Perl Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close