Re: Outlook Express script: forward email as attachment
Re: Outlook Express script: forward email as attachment
- Subject: Re: Outlook Express script: forward email as attachment
- From: Paul Berkowitz <email@hidden>
- Date: Mon, 01 Sep 2003 10:21:35 -0700
When you're making an outgoing message "behind the scenes" you have to
include the signature as part of the message body. There are clever ways to
get that from the default account but since you're doing this just for
yourself, you can just hard-code it in. (I've put "Riccardo" under the
sig-delimiter: change it to what you want.)
If you're on dial-up and don't want to send the message until your next Send
& Receive schedule just remove the final 'send' line. When you're just
sending to one recipient, it's very simple, as below. If you're sending to
more than one recipient, including CC's etc., let me know: it's much more
complicated - the method below is an undocumented shortcut that works only
for a single TO recipient.
(I'm not 100% certain that this will work properly if you run the script a
second time on the same message-attachment. You may get an error - I can't
test in OS 9. because I'm in 10.2.6. There will be ways around it, but they
are complicated. Deleting the first file by the Finder is _not_ reliable in
OS 9: it won't have finished by the time you try to create another file of
the same name. If that in fact is a problem (test it out), the simplest
thing is probably to get Jon's Commands scripting addition rather than do
very complicated text parsing: come back if there's a problem.)
set tempPath to (path to temporary items as string)
tell application "Outlook Express"
set theMsg to item 1 of (get current messages)
set theSubject to subject of theMsg
set revSubject to my ReplaceColons(theSubject)
set filePath to (tempPath & revSubject)
save theMsg in filePath
set theRecip to "\"Joe Blow\" <email@hidden"
set mySubject to "Whatever you want" -- or:
-- set mySubject to "FW: " & theSubject
set theBody to "Here's another message I'm forwarding to you." & return
& return & "-- " & return & "Riccardo" & return
set newMsg to make new outgoing message at out box folder with
properties {subject:mySubject, content:theBody, recipient:theRecip,
attachment:{file:alias filePath}}
send newMsg -- or not
end tell
to ReplaceColons(someText)
set AppleScript's text item delimiters to {":"}
set ls to text items of someText
set AppleScript's text item delimiters to {"-"}
set someText to ls as string
set AppleScript's text item delimiters to {""}
if length of someText > 31 then set someText to text 1 thru 30 of
someText & ";" -- type option-; there (stupid list server configuration)
return someText
end ReplaceColons
--
Paul Berkowitz
>
From: Riccardo Cannaviello <email@hidden>
>
Date: Mon, 01 Sep 2003 09:45:24 -0700
>
To: Paul Berkowitz <email@hidden>
>
Subject: Re: Outlook Express script: forward email as attachment
>
>
Thank you for your prompt response!
>
>
I want a "behind the scenes" script that automatically forwards the email as
>
an attachment to a pre-set recipient. Without doing anything on the screen.
>
>
What would that script be, please?
>
>
>
> From: Paul Berkowitz <email@hidden>
>
> Date: Mon, 01 Sep 2003 09:26:03 -0700
>
> To: AppleScript-Users <email@hidden>
>
> Subject: Re: Outlook Express script: forward email as attachment
>
>
>
> On 9/1/03 7:51 AM, "Riccardo Cannaviello" <email@hidden> wrote:
>
>
>
>> Is there a reliable AppleScript for Outlook Express 5.0.6 that will forward
>
>> an email as attachment?
>
>>
>
>> I run Outlook Express 5.0.6 on OS 9.2.2
>
>
>
> Forward how exactly? When you select a message, manually or by a rule, and
>
> run the script, do you want that message to appear as an attachment in a
>
> blank message window on the screen, ready for you to enter To;, Subject: the
>
> message body, etc.? Or do you want to use some pre-existing text for the
>
> message body and perhaps a pre-set recipient? That would allow the message
>
> to be made "behind the scenes" without doing anything on the screen?
>
>
>
> In either case, the technique is to save the message (as an .eml file) to
>
> disk, somewhere like the temporary items folder where you won't see
>
> anything, then use the saved file as the location for the attachment. It's
>
> pretty easy, aside from routines which are needed to replace ":" characters
>
> in the name when saving to disk and reducing the name of the file to under
>
> 32 characters (since you're in OS 9). In those cases the attachment will
>
> have its name truncated. here's the basic idea for an open message window. I
>
> can't test in OS 9 at the moment since I'm in 10.2
_______________________________________________
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.