Re: How to create a new outgoing message with a signature assigned
Re: How to create a new outgoing message with a signature assigned
- Subject: Re: How to create a new outgoing message with a signature assigned
- From: Paul Berkowitz <email@hidden>
- Date: Fri, 03 May 2002 09:09:46 -0700
On 5/3/02 10:00 AM, "Luc Naets" <email@hidden> wrote:
>
Hi everybody
>
>
I think this is a question for Paul Berkowitz.
>
>
I want to create a new message in outlook Express 5.02 with a certain
>
signature assigned to it.
>
>
Now I create a new outgoing message without a standard signature assigned
>
>
the script looks like
>
copy (make new outgoing message ,
>
with properties ,
>
{account:myPOPaccount ,
>
, recipient:{address:{address:theMailAdress, display
>
name:(theRecepientsName)}} ,
>
, subject:theSubject ,
>
, color:{0, 0, 45535} ,
>
, content:mContent ,
>
, sender:{address:"email@hidden", display name:"Luc Naets"} ,
>
}) to myMessageID
>
>
Can a signature be added to this message or do I have to put it in the
>
message as last element
>
Glad to oblige.
Signatures in OE are rather odd things. You cannot set one, or get one, as a
property of a message. It has something to do with the fact that once a
message has been saved, its encoding doesn't allow AppleScript to figure out
what part of the message content is the signature. Since having a
"write-only" property is not standard (although it does exist for 'password'
of an account, as a security measure), it wasn't implemented at all. You
can, of course, set the signature of a draft window open on the screen, but
you probably don't want to do that here, right? If you want to send the
message automatically without opening it up into a draft window, you have to
add the content of the signature to the message content (first or later
doesn't really matter).
Assuming you already have the signature in question saved in OE , just do it
like this:
set sigContent to content of signature "Special"
set mContent to mContent & return & return & sigContent
set myMessageID to make new outgoing message with properties
{account:myPOPaccount, recipient:{address:{address:theMailAdress, display
name:(theRecepientsName)}}, subject:theSubject, color:{0, 0, 45535},
content:mContent}
You shouldn't need to specify the sender if you have your name and email
address properly listed for your account (in Tools / Accounts), unless, of
course, you're specifically setting a different "false" sender here, which
you can do if you want. It's like making a separate Reply-To address just
for this message. If you don't need to do that, don't bother with sender.
BTW, if you're just sending to one TO recipient, you can always do it this
way instead:
set myMessageID to make new outgoing message with properties
{account:myPOPaccount, recipient:theRecepientsName & " <" & theMailAdress &
">", subject:theSubject, color:{0, 0, 45535}, content:mContent}
That may still look a little messy, but it's a nice advantage when you don't
need to use variables. (Mind you, it's good practice to put the display name
in quotes in case there's any punctuation in the name:
recipient:"\"Joe A. Bloggs\" <email@hidden>"
The complicated
recipient:{{address:{address:"" , display name:""}, recipient type:cc
recipient}}}
is the format set out by Apple's Mail Suite (which I don't think they follow
themselves in their new Mail.app), and followed by OE. It's needed for a
list of recipients and/or where cc or bcc recipient type has to be
specified, but the simple
recipient:"Display name <email@address>"
format, not documented in the Dictionary, is a nice shorthand method that
works.
--
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.