Re: re: Scripting Entourage to Send Mail in Chunks??
Re: re: Scripting Entourage to Send Mail in Chunks??
- Subject: Re: re: Scripting Entourage to Send Mail in Chunks??
- From: email@hidden
- Date: Wed, 10 Jul 2002 15:16:23 EDT
I thank you so much for your help so far Paul, you definitely solved my
listing problem! The script will now run! Yea! However . . . I am still
having one difficulty.
The problem I'm having with sending mail to my lists is almost exclusively
with Yahoo, but I'm not doing a multiple recipients/blind copy type of thing,
it's all individual slightly-different messages with a sole addressee. If I
send a number of emails with Yahoo recipients that is greater than 40 (I'm
still experimenting, I don't know what the exact number is, just that it's
more than 40 . . . 5 was just an arbitrary number) in the same SMTP
connection with my ISP, some of those messages will immediately result in a
"delay" message from Yahoo something along the lines of "message delayed,
Yahoo reset the connection." Ultimately some of those messages will get
through, while some will ultimately be returned to me about 4 days later as
complete failures, even though the the email address is still valid and the
member subscribed. Annoying!
Here's what I have now:
set max to 5
tell application "Microsoft Entourage"
set n to count (every message in out box folder)
set allMessages to (every message in out box folder)
repeat while n > 0
if n = max or n < max then
set chunklet to (every message in out box folder)
else
set chunklet to items 1 thru max of allMessages
end if
send chunklet
repeat while connection in progress
end repeat
delay 200
set n to count (every message in out box folder)
set allMessages to (every message in out box folder)
end repeat
end tell
(I know 200 is probably too large a number for the delay, I just put it in
there to make sure the problem I'm having wouldn't go away with a larger
number. It won't.)
I THINK what I ultimately need this to accomplish is for Entourage to
completely drop/stop/halt/whatever the current SMTP connection with Earthlink
(my ISP). That way, hopefully Yahoo will recognize the "fresh" connection as
just that, and hopefully not do its "reset" thing and delay/bounce my mail 4
days later. However, when I run this in Entourage, the mail sends more
slowly, like it does pause a bit, but the Progress window is indicating that
the connection is still maintained, and that continues to be the case until
all the messages in my Outbox are gone. I need to somehow just drop the
connection entirely then start anew midcount. I'm looking in the
dictionaries but not seeing that. Short of quitting the application and
restarting it a jillion times, is there another way to accomplish this? :)
In a message dated 7/10/02 11:17:15 AM, email@hidden writes:
<< On 7/10/02 9:57 AM, "email@hidden" <email@hidden> wrote:
>
Hi Applescripters. I've had some experience Applescripting, but . . .
>
apparently not enough! If any experienced folk could look at what I'm doing
>
and tell me the (probably obvious to many, just not to me) thing I'm doing
>
wrong, it would make my day!
>
>
I'm trying to write a script that will look at the messages in my Outbox (in
>
Entourage, but it could be any Mac OS X compatible email app, if another
>
would be better), decide how many, send a few (say, 5), delay a number of
>
seconds to let the connection die, then reconnect and send another chunk
>
until every message in the Outbox has been sent. (If you care or are
worried
>
about why I'm trying to do this, please read at bottom of mail.)
>
>
I wrote the following but it doesn't work:
>
>
set max to 5
>
tell application "Microsoft Entourage"
>
set n to count (every message in folder "Outbox")
>
repeat while n > 0
>
if n > max then
>
set chunklet to messages 1 thru max of folder "Outbox"
>
else
>
set chunklet to (every message in folder "Outbox")
>
end if
>
send chunklet
>
delay 15
>
set n to count (every message in folder "Outbox")
>
end repeat
>
end tell
>
>
I keep getting this error: "Microsoft Entourage got an error: Can't get
>
messages 1 thru 5 of folder "Outbox." How can I get it to . . .get the
>
messages? Or alternatively, if someone else has a better way or other
>
suggestions about how to do this that would be fabulous too, this was just
>
the best (??) way I could think of so far.
You can't get 'messages 1 thru 5': that terminology is for AppleScript lists
only, not for folder messages. But that's quite easy to do:
set allMessages to (every message in out box folder)
--allMessages is a list
set chunklet to items 1 thru 5 of allMessages
Fortunately for you, 'send' will operate on an AppleScript list. There are
better ways to do this than counting every time and making a new list every
time, but it will still work.
However
delay 15
will paralyze Entourage for the duration, (Correct you don't need 'seconds':
check the Dictionary for 'delay' in Standard Additions:
delay [integer] -- the number of seconds to delay
integer is just a number.)
Much better would be to use Entourage's own commands
repeat while connection in progress
delay 1
end repeat
or, even better:
repeat while connection in progress
end repeat
However, you probably don't need to delay at all. usually the SP restriction
is on the number of recipients per message, not the number of messages being
sent. the messages will all queue up and not jam. You should be able to send
one after another. Does Yahoo really prevent more than 5 messages at a time
from going out?
>
>
Also, for my delay I was hoping for 15 seconds or so, but when I type
>
"seconds" after delay it says, "expected end of line, but found class name."
>
Do I not need the word "seconds?" Is seconds automatic?
>
>
Any help would be most appreciated!!
>
You might want to check out a script of mine
Split Recipients
at
AppleScript Central
<
http://www.applescriptcentral.com/>
That way, you can put all your recipients into a single group, set the limit
of recipients as to your ISP (or Yahoo's) limitations (its 50 at mac.com,
for example), and the script will send as many copies as needed with that
limit.
--
Paul Berkowitz >>
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.