[Chicago-talk] emailing from perl

Alan Mead amead2 at alanmead.org
Wed Aug 1 21:42:47 PDT 2007

Andrew Rodland wrote:
> in one of three predefined locations). So, hardly portable. I'd suggest 
> tearing it out and replacing it with calls to Email::Send, which knows 
> several ways to send mail, so you can tell it about one that will work for 
> you. Or else, you can tell it to be smart and try several :)

I've also had good luck with MIME::Lite which can handle attachments and
SMTP (copying from the man page):

  MIME::Lite->send('smtp', "smtp.myisp.net", Timeout=>60);

    $msg = MIME::Lite->new(
                 To      =>'you at yourhost.com',
                 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="cid:myimage.gif">
                             </body> }
    $msg->attach(Type => 'image/gif',
                 Id   => 'myimage.gif',
                 Path => '/path/to/somefile.gif',


Alan D. Mead, Ph.D. 
Assistant Professor, Institute of Psychology
Scientific Adviser, Center for Research and Service
Illinois Institute of Technology
3101 South Dearborn, 2nd floor
Chicago IL 60616

Skype: alandmead
+312.567.5933 (Campus)
+815.306.0655 (Home Office; summer 07)
+312.567.3493 (Fax)


Be not afraid of life. 
Believe that life is worth living, 
and your belief will help create the fact.
  -- Henry James

More information about the Chicago-talk mailing list