Example: Send email from Perl via AppleScript using Entourage

  • Thread starter gimme_this_gimme_that
  • Start date
G

gimme_this_gimme_that

This Perl script sends a message having a pdf attachment via Entourage
(via an IMAP email account).

Modify "ann_example" per your account.

#!/usr/bin/perl

use Mac::AppleScript qw(RunAppleScript);

# In Preferences you must set uncheck Warn before allowing an external
application to send mail
# You may have to check remember my password when you send a message
from Entourage so you don't get prompted to log in to your IMAP
server.

my $subject = "The igawk file you wanted : Test ACFD1FE";

my $content=<<EOF;
Attached is igawk.1.pdf
Enjoy
EOF

my $recipient = '(e-mail address removed)';

my $script=<<EOF;
tell application "Microsoft Entourage"
activate
set filePath to "Macintosh
HD:Users:ann_example:Documents:igawk.1.pdf"
set msg to make new outgoing message with properties
{subject:"$subject", content:"$content", recipient: "Ann Example <
$recipient>", attachment:alias filePath, account:IMAP account
"ann_example"}
send msg
end tell
EOF

RunAppleScript($script) or die "Didn't work!";
 
J

Jolly Roger

This Perl script sends a message having a pdf attachment via Entourage
(via an IMAP email account).

That's nice and all, but personally I'd rather just do it all with Perl
and not be tied to a certain email application, or depend on an email
application running. The Mail::Sender and Mail::Sender::Easy Perl
modules are top-notch, and let you send most any type of email you
would want (over encrypted connections, with attachments, etc.), all
without being locked into a certain email application or requiring an
email application to be running.

Mail::Sender: <http://search.cpan.org/~jenda/Mail-Sender-0.8.13/Sender.pm>

Mail::Sender::Easy:
<http://search.cpan.org/~dmuey/Mail-Sender-Easy-v0.0.5/Easy.pm>
 
G

gimme_this_gimme_that

Agreed. Perl's IMAP modules are easy to use and get you there more
directly.

At some Windows shops the admins turn off IMAP and you're stuck with M
$'s proprietary mail solutions.

This approach would be sort of a work around, but not only that, you
have access to all the other M$ goodies like the calendar and address
book.

All through Perl.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top