Sending mail through Mail::Outlook

Discussion in 'Perl Misc' started by paddyxmurphy@googlemail.com, May 25, 2006.

  1. Guest

    Hi,

    I am using Mail::Outlook to send email through Outlook. I've set out
    the code below. Everything works fine but I have two items on my wish
    list.

    1. To be able to send attachments. I have tried
    '$message->Attachments('c:\file.txt');' and
    '$message->Attachments.Add('c:\file.txt');' but neither work.
    2. To be able to send the email in html format but
    '$message->HTMLBody($body);' doesn't work.

    Are either of these possible using Mail::Outlook or do I need to go
    back to scratch and use another module?

    Thanks

    Paddy

    #################################################################################
    # CODE

    #!/usr/bin/perl

    use strict;
    use warnings;

    use Mail::Outlook;
    use Win32::OLE::Const 'Microsoft Outlook';
    my $outlook = new Mail::Outlook();

    my $to = "my_mom\@moms_mail.com";
    my $body = "Hi Mom!\n\n etc.";
    my $message = $outlook->create();

    $message->To($to);
    $message->Cc();
    $message->Bcc();
    $message->Subject('Happy Mothers Day, Mom!);
    $message->Body($body);
    #$message->HTMLBody($body);
    #$message->Attachments('c:\Card.pdf');
    $message->send;
     
    , May 25, 2006
    #1
    1. Advertising

  2. Brian Wakem Guest

    wrote:

    > Hi,
    >
    > I am using Mail::Outlook to send email through Outlook.



    Why on Earth would you want to do that?


    > I've set out
    > the code below. Everything works fine but I have two items on my wish
    > list.
    >
    > 1. To be able to send attachments. I have tried
    > '$message->Attachments('c:\file.txt');' and
    > '$message->Attachments.Add('c:\file.txt');' but neither work.
    > 2. To be able to send the email in html format but
    > '$message->HTMLBody($body);' doesn't work.




    The module's documentation does not mention either $message->Attachments or
    $message->HTMLBody. Have you just made these up in the hope it might work?



    > Are either of these possible using Mail::Outlook or do I need to go
    > back to scratch and use another module?




    Try MIME::Lite.


    --
    Brian Wakem
    Email: http://homepage.ntlworld.com/b.wakem/myemail.png
     
    Brian Wakem, May 25, 2006
    #2
    1. Advertising

  3. "" <> wrote in
    news::

    > I am using Mail::Outlook to send email through Outlook. I've set out
    > the code below. Everything works fine but I have two items on my wish
    > list.
    >
    > 1. To be able to send attachments. I have tried
    > '$message->Attachments('c:\file.txt');' and
    > '$message->Attachments.Add('c:\file.txt');' but neither work.
    > 2. To be able to send the email in html format but
    > '$message->HTMLBody($body);' doesn't work.
    >
    > Are either of these possible using Mail::Outlook or do I need to go
    > back to scratch and use another module?


    Unless the only way you can send email is through Outlook, I would
    recommend looking at other modules.

    perldoc -q "How do I send mail"

    If you *must* use Outlook to send email, looking at Mail::Outlook and
    Mail::Outlook::Message, my instinct is to ditch the module.

    Note that an excellent source of information for Microsoft Office
    applications is the Object Browser. You can access it via Tools -> Macro
    -> Visual Basic Editor. Once you are in the editor, hit F2 to browse the
    interfaces, methods, and properties provided by Microsoft Office
    applications.

    An example of dealing with Outlook via OLE:

    http://www.unur.com/comp/ppp/perl-win32-ole-outlook-ex1.html

    Sinan
    --
    A. Sinan Unur <>
    (remove .invalid and reverse each component for email address)

    comp.lang.perl.misc guidelines on the WWW:
    http://augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
     
    A. Sinan Unur, May 25, 2006
    #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. Replies:
    0
    Views:
    1,468
  2. param
    Replies:
    3
    Views:
    1,735
    mearvk
    Dec 7, 2006
  3. Rishi
    Replies:
    1
    Views:
    1,157
    Bob Barrows
    Sep 17, 2009
  4. Jade Tucker

    Outlook, MAPI, Sending Mail

    Jade Tucker, Aug 18, 2008, in forum: Ruby
    Replies:
    4
    Views:
    437
    Jade Tucker
    Aug 19, 2008
  5. Kevin B. Pease
    Replies:
    1
    Views:
    389
    A. Sinan Unur
    Nov 19, 2004
Loading...

Share This Page