The code below allows me to create an email reply:
tell application "Mail"
set theAttachmentFile to "path"
set theMessages to the selected messages of the front message viewer
set theMessage to first item of theMessages
set theOutgoingMessage to reply theMessage with opening window and
reply to all
end tell
in this situation I'm not able to add an attachment file to the replay front message. In what way can i do that? Is it possible?
Thanks!
Related
This script selects my main account and the signature related to it.
tell application "Microsoft Outlook"
set theContent to "Mail Content etc."
set theMessage to make new outgoing message with properties {subject:(("Month ") & (do shell script "date '+%m'")), content:theContent}
make new recipient with properties {email address:{address:"to#mail.com"}} at end of to recipients of theMessage
make new recipient with properties {email address:{address:"to#mail.com"}} at end of cc recipients of theMessage
open theMessage
end tell
I would like to add a line that picks one of several POP accounts to send from.
Ideally the resulting mail has the signature stored under that address.
I want to periodically programmatically check whether a new SMS message has arrived from a specific sender. If it came, then I want to copy text the text to the clipboard.
using terms from application "Messages"
on message received theMessage from theBuddy for theChat with eventDescription
set the clipboard to theMessage
end message received
end using terms from
I'd like to send a mail using a Mac Automator action. I prepared the following mail script:
set recipientName to "<recipient>"
set recipientAddress to "<recipient mail address>"
set theSubject to "<mail subject>"
set textBody to "<text>"
tell application "Mail"
set theMessage to make new outgoing message with properties {subject:theSubject, content:textBody, visible:true}
--set recipient
tell theMessage
make new to recipient with properties {name:recipientName, address:recipientAddress}
--send the message
send
end tell
end tell
now when I send this it uses the Account that is basically currently selected (highlighted) in the Mail App.
Is there any way to choose a specific account?
You need to set the sender of theMessage to a valid address of one of your accounts.
e.g.
set recipientName to "<recipient>"
set recipientAddress to "<recipient mail address>"
set theSubject to "<mail subject>"
set textBody to "<text>"
set theSender to "dragon5689#stackoverflow.com" -- your valid account email here
tell application "Mail"
set theMessage to make new outgoing message with properties {subject:theSubject, content:textBody, visible:true, sender:theSender}
tell theMessage
make new to recipient with properties {name:recipientName, address:recipientAddress}
send
end tell
end tell
Right now I have a simple little AppleScript that will take the currently selected message and open a reply to window for the message.
I'm doing this to eliminate the default signature from the reply. For some reason Outlook 2011 does not have an option to exclude the signature on replies but using this script keeps the signature off.
Here's my script:
tell application "Microsoft Outlook"
set replyMessage to selection
set replyMessageSubj to subject of replyMessage
reply to replyMessage
end tell
tell application "Finder" to activate (every window whose name is "Re: " & replyMessageSubj)
That opens the replay window and activates it for me. Works well but I'd like to have it reply all, not just reply.
The dictionary for Outlook 2011 says:
reply to v : Create a reply message.
reply to message : The message to reply to.
[opening window boolean] : Should the reply message be opened in a window? Default is to show the window.
[reply to all boolean] : Whether to reply to all recipients of the message. Default it to reply to the sender only.
→ message : The reply message.
I'm a bit of an AppleScript novice and can't find a good example...
How do I get this to reply all?
Try:
tell application "Microsoft Outlook"
set replyMessage to selection
set replyMessageSubj to subject of replyMessage
reply to replyMessage with opening window and reply to all
end tell
I'll preface this with the fact that I'm new to applescript...
I have iChat set up to run this script whenever a new message is received:
using terms from application "iChat"
on message received theMessage from theBuddy for theChat
set theHandle to handle of theBuddy
tell application "MyApp"
receivedInstantMessage from theHandle message theMessage
end tell
end message received
end using terms from
This works as expected an MyApp (which I'm coding) receives two strings (the handle of the buddy and the message content). The only trouble is that this script only seems to work once at least one message has been received in iChat. I.e the script seems to only work from the second message onwards. If the buddy logs out, he'll have to send two messages again before my app receives the AppleEvent.
Am I making a basic mistake here?
The first message is actually a "text invitation" so your notification script will need another handler:
on received text invitation theMessage from theBuddy for theChat
-- your tell app statement goes here
end received text invitation