Applescript: Forward message to another ISP

G

Gnarlodious

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?

--Gnarlie
 
P

Paul Berkowitz

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.
 
G

Gnarlodious

Thanks for the tip.

Entity Paul Berkowitz spoke thus:
(Why would the ISP be interested in
dealing with mail sent via a different ISP?
The reason is, I have 2 ISP's: Earthlink and Cybermesa, when I forward
Cybermesa spam I report it to Cybermesa but I send THROUGH the Earthlink
account because that's the ISP I'm connected to.
Just doing my part in the ongoing Spam Wars.
set the account of forwardMsg to preferredAcct
Got it:
set fwdMsg's account to preferredAcct

works well.

But speaking of Preferred Account, in a WinOS you can set it to send using
"Any Available Connection". This would be very useful in Entourage. Is there
a way to tell Entourage to use any account that is currently viable?

I suppose as a last resort I could loop through every SMTP account until it
goes without an error.

--Rachel
 
P

Paul Berkowitz

I suppose as a last resort I could loop through every SMTP account until it
goes without an error.

Or you could use my "SMTP Location X" script to set your SMTP server for all
accounts automatically. Then no matter which POP account you sent from, the
SMTP account would be the correct active one...

--
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.
 
G

Gnarlodious

Entity Paul Berkowitz spoke thus:
Or you could use my "SMTP Location X" script to set your SMTP server for all
accounts automatically. Then no matter which POP account you sent from, the
SMTP account would be the correct active one...
Thanks, Paul! I didn't know all those great scripts were to be found in your
public folder.

--Rachel
 

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