[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] scripting eudora within macperl



(resending this to the list, responding to Jeff Lowrey):

>Could we see the code that causes what you posted to break?

message:
Here's what doesn't work.

-Ken

#! perl -w

$file = "HD:Desktop Folder:test.pl"; #use this file as a test
open(IN, $file);
while (<IN>)  {
	if (/^(\w+:)\s*$/) {
		$where = $1 unless ($where eq "message:"); #problem here with
						#colons in message - FIX
		$where =~ tr/A-Z/a-z/;
		next;  #look at next line
	}

	if ($where eq "message:") {
		#add lines to message list, including blank lines
		push @msg, $_;
		next;
	}

}

@addressee = (address1, address2);
$subject = "test subject";
$ccto = "";
$bccto = "";
#@msg = ("this is a test message\n", "and this is the second line\n");
#PROBLEM in above line: works if uncommented, otherwise not
$msg = join("", @msg);

foreach $line (@addressee) {
	$to = "$line";
	$from = "kpierce\@mit.edu";

MacPerl::DoAppleScript(<<END_SCRIPT);
tell application "Eudora Pro"
 make message at end of mailbox "out" of mail folder ""
 set field "to" of message 0 to \"$line\"
 set field "from" of message 0 to \"$from\"
 set field "subject" of message 0 to \"$subject\"
 set field "cc" of message 0 to \"$ccto\"
 set field "bcc" of message 0 to \"$bccto\"
 set field "" of message 0 to \"$msg\"
 save message 0 -- saves it in outbox; not queued
end tell
END_SCRIPT
}



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch