Re: PowerMail: Sending and CCing to Messrs Foo & Bar
Re: PowerMail: Sending and CCing to Messrs Foo & Bar
- Subject: Re: PowerMail: Sending and CCing to Messrs Foo & Bar
- From: Nigel Garvey <email@hidden>
- Date: Tue, 16 Apr 2013 20:31:48 +0100
JF wrote on Tue, 16 Apr 2013 15:17:45 +0100:
>I am having a problem with setting up a "to recipient" and a "cc
>recipient". I have tried many variations and I cannot get both to go
into
>the same email. Here is my latest version, which allows Mr Foo to be a
CC
>recipient, but Mr Bar is left out completely even though he is the more
>important "to recipient".
>_____________________________________
>
>tell application "PowerMail"
>activate
>set msg to make new message with properties {account:"Moi",
status:draft,
>subject:"Foo4", content:return & return & "Herewith this document:" &
>return & return &", recipient:{{recipient type:cc recipient,
address:{"Mr
>Foo <email@hidden>"}}, recipient:{{recipient type:to recipient,
address:{"Mr
>Bar <email@hidden>"}}}}}
>set other headers to {"Return-Receipt-To: Moi <email@hidden>" & return &
>"Disposition-Notification-To: Moi <email@hidden>"}
>display dialog " A new message was created in your Out Tray."
>open out tray
>
>Also, can the script be laid out better in lines, not using {} and
>commas so much but having
>"set msg to make new msg" on one line, then
>set recipient...
Hi.
'Recipients' are _elements_ of 'messages' (ie. there can be more than
one per message), not properties, so they have to be created separately.
PowerMail handily allows recipients to be defined in more than one way.
For instance:
make new recipient of msg with properties {recipient type:cc recipient, address:{display name:"Mr Foo", email address:"email@hidden"}}
Or:
make new recipient of msg with properties {recipient type:cc recipient, address:"Mr Foo <email@hidden>"}
The latter has the simplicity you seem to be after.
'Other headers' is a property of an 'account', not of a 'message'. You'd
normally set it as a permanent value in the account configuration (Setup
-> Mail Accounts… -> <account name> -> Identity -> Advanced) rather than
scripting it for individual messages.
So:
tell application "PowerMail"
activate
set msg to (make new message with properties {account:"Moi", status:draft, subject:"Foo4", content:return & return & "Herewith this document:" & return & return & ""})
make new recipient of msg with properties {recipient type:to recipient, address:"Mr Bar <email@hidden>"}
make new recipient of msg with properties {recipient type:cc recipient, address:{display name:"Mr Foo", email address:"email@hidden"}}
display dialog " A new message was created in your Out Tray."
open out tray
end tell
I've created the to recipient first as this encourages PowerMail to show
that recipient's name in the Out Tray listing.
NG
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden