OK Paul, here's my problem.
I'm receiving spam through one account and need to forward it through
another account. I have a working script but it sends the spam to the same
ISP it came from which then errors unless I change the account manually.
I can say:
set newMsg to make new outgoing message at out box folder with properties
{account:theAccount}
and the new message goes to the desired ISP, but this doesn't work for a
forwarded message. How do I tell the forwarded to send to a different
account than it came from?
Rachel,
This isn't entirely clear to me. I guess it's essential that the message be
seen as a Forward, as well as now coming from a particular account,
different than the account you received the message at? Is that it? (Why
would the ISP be interested in dealing with mail sent via a different ISP?
Or if it's the same ISP for both accounts, why won't they accept it from the
original account?)
If you take a good look at the 'forward' command in the dictionary:
forward: Forward a message
forward message -- the message to forward
[to Unicode text] -- recipients of new message (as text)
[opening window boolean] -- Should it create a window or a message?
(Default is to create window)
[html text boolean] -- Should the forward be HTML?
Result: reference -- to the resulting message or window
you'll see that it has a result. If the message is made 'without opening
window', the result will be an outgoing message; if it's made 'with opening
window' (the default) the result willbe a draft window - so you can add
other text. Just set a variable to the result - i.e. to the command itself.
In either case you can then simply change the account of the message (or
draft window) to the one you want, and then send it.
To forward a message automatically:
tell application "Microsoft Entourage"
set preferredAcct to POP account "Whatever"
set spamMsg to item 1 of (get current messages)
set forwardMsg to forward spamMsg to "My ISP <
[email protected]>" without
opening window -- forwardMsg is the result
set the account of forwardMsg to preferredAcct
send forwardMsg
end tell
To open it on the screen so you can add some righteous text:
tell application "Microsoft Entourage"
set preferredAcct to POP account "Whatever"
set spamMsg to item 1 of (get current messages)
set forwardMsg to forward spamMsg to "My ISP <
[email protected]>" -- a
draft window is the result, opening window
set the account of forwardMsg to preferredAcct
end tell
Variables can be very useful, as you can see. So are commands that create
results. Without setting a variable, or the implementation of 'forward'
having a result, you wouldn't be able to alter the message. You can even
alter the text after creating the forward:
tell application "Microsoft Entourage"
set preferredAcct to POP account "Whatever"
set spamMsg to item 1 of (get current messages)
set forwardMsg to forward spamMsg to "My ISP <
[email protected]>" without
opening window -- forwardMsg is the result
set the account of forwardMsg to preferredAcct
set theContent to content of forwardMsg
set theHeaders to headers of spamMsg -- the original message
set content of forwardMsg to theHeaders & return & return & "Look at
what these idiots sent me:" & return & return & theContent
send forwardMsg
end tell
--
Paul Berkowitz
MVP Entourage
Entourage FAQ Page:
http://www.entourage.mvps.org/toc.html
Please "Reply To Newsgroup" to reply to this message. Emails will be
ignored.
PLEASE always state which version of Entourage you are using - 2001 or X.
It's often impossible to answer your questions otherwise.