Scheduling an email to send in mail (mac) - macos

I have an email that I need to schedule to send later. I know you can schedule an apple script to fire off at a set time using iCal, but I have been unable to find one that works. It doesn't necessarily have to be done this way though. I would be grateful of a solution to this problem.

This works for me with a run script alarm in iCal on 10.6.8
tell application "Mail"
activate
set mymail to make new outgoing message at the beginning of outgoing messages with properties {subject:"Triggered"}
tell mymail
make new to recipient at beginning of to recipients with properties {address:"first#email.com, second#email.com"}
set content to "hi"
end tell
--show message window (otherwise it's hidden)
set visible of mymail to true
--bring Mail to front
activate
send mymail
end tell

I'm also getting an error like outgoing message 1 doesn’t understand the send message when trying to send an outgoing message. Referring to a message created from a script still seems to work though.
tell application "Mail"
set m to make new outgoing message with properties {subject:"subject", content:"content"}
tell m
make new to recipient at end of to recipients with properties {address:"jana#doe.com, john#doe.com"}
end tell
send m
end tell
You could also create a Calendar alarm in Automator.

I just accomplished this without Automator, using only Apple Mail:
Double-click anywhere your calendar to start creating an event.
Give the event a name. This will be the subject line of the email.
Set the date and time of the event to when you want the email to be sent.
If you want the email to be sent on a schedule, choose a repeat frequency and potential termination date.
For the alert, choose Custom....
Select email. You might be prompted to add a contact card to the Contacts app.
Choose the person to whom you want to send the email, and set the time to At Time Of Event. Press OK.
You can choose to add Notes, a URL, or attachments. I haven't tried these options, but I assume that they are carried forward in the email that is sent.

Related

Select mailbox for Microsoft Outlook when using Applescript

I'm using Applescript to automatically draft and send emails in Microsoft Outlook. While everything is working as expected to send emails from my own account, I want to adjust the script to send emails from a different account that I have access to in Outlook. I've found this post, but the approach shown there generates an error for me.
https://macscripter.net/viewtopic.php?pid=185222#p185222
How can I adjust the script below to select the correct mailbox to send my email from? When I use the script below, the following error is generated when I attempt to save it.
Syntax Error
Expected class name but found identified
I've Google this error message, but haven't been able to find anything relevant to my task of changing the account the email is sent from.
set theAccount to the first exchange account whose name is "second.account#company.com"
set recipientAddress to "first.last#company.com"
set theSubject to "This is only a test"
set theContent to "<html><body><p>This is only a test.</p></body></html>"
tell application "Microsoft Outlook"
set newMessage to make new outgoing message with properties {account:theAccount, subject:theSubject, content:theContent}
tell newMessage
make new recipient at newMessage with properties {email address:{address:recipientAddress}}
end tell
save in drafts
end tell

How to access the recipients list of an unsent Outlook message from Applescript

I'm trying to put together an Applescript (MacOS 10.15.6) that will read the recipients of a newly-composed but unsent message in Outlook (v16.40). So, to clarify, I'd:
Start a new message in Outlook
Add some recipients to the To and Cc fields
Run the Applescript and have access to the recipient information before the message is sent.
I've hit a stumbling block straight away: I can't seem to access the new message.
tell application "Microsoft Outlook"
set newMessage to get (outgoing message)
set reciplist to every recipient of newMessage
end tell
gives the syntax error
Can’t get every recipient of outgoing message.
I can't find any examples of looking at unsent and unsaved messages - is such a thing possible?

applescript send SMS message

I am trying to send NEW messages using applescript through the macos messages app.
on run {targetBuddyPhone, targetMessage}
tell application "Messages"
send targetMessage to buddy targetBuddyPhone of service "SMS"
end tell
end run
The above script runs fine on the condition that there is already a conversation started for the specific targetBuddyPhone in the messages app. Any ideas how to send a NEW message?.. I can't believe it isn't possible.
It could be possible to call URL from Apple Script in this form:
sms://open?addresses=+15558675309,+15558675301/&body=Text%20Here%20end!
It will not send message, but just prefill it and user will need to press Enter key.

Use applescript to set multiple signatures in Outlook 11

I'm trying to create an applescript to use on outgoing email messages in Outlook 11 for Mac to dynamically set the email signature in the message based on who the sender address is. I have multiple accounts in Outlook, and would like to change the signature based on which one I'm using. Below is the code I've been trying, but have not had any success. Any advice?
tell application "Microsoft Outlook"
if message sender contains {name:"emailaddress"} then
set the message signature to signature {name:"signaturename"}
else
set the message signature to signature {name:"signaturename2"}
end if
end tell
If I understand your question, I think Outlook 2011 has this capability built in, without the need for any scripting.
Click "Outlook", then "Preferences..." from the Outlook menu
Click the "Signatures" icon
Set up the signatures you need if you haven't already done so, and give them meaningful names
Click the "Default Signatures..." button
Associate the relevant signature to each account that you require
There seems to be a bit of a trick to using this. If you want the signature for account X to appear automatically in a new message, then you must first select a folder from account X before creating a new message. If you do that, then the message should include the correct signature that you have set up for that account.

Receive Adium messages in Applescript

I'm trying to write a simple chat bot for Adium, that will post "lol" and "haha" and answer basic questions in annoying group chats that some people keep adding me to.
I've covered the "lol" part with a few simple send and delay commands in a repeat, but I need to do some interaction as well.
Answer "yes" to anything with a question mark for example...
Believe me or not, such a simple bot would pass a Turing Test for those conversations.
Opening the Adium dictionary does not reveal any obvious way of getting messages, nor does the Growl dictionary.
I did found out that I can run a script every time a message is received, Is there a way to get access to the sent message?
Adium pref http://media.ruk.ca/images/adiumpreferences.png
My code:
tell application "Adium"
activate
set theChat to the active chat
send theChat message "Hi"
delay 5
send theChat message "How's life?"
delay 10
repeat 10 times
send theChat message "Realy?"
delay 5
send theChat message "Lol :P"
delay 15
send theChat message "Haha XD"
delay 15
send theChat message "Yes1!!1"
delay 20
send theChat message "I like it! :D"
delay 10
end repeat
send theChat message "Bye!"
tell theChat to close
end tell
You can pipe to a script using Pipe Event as well now.
Based on review of the current Adium sourcecode and a search for current and past items in the Adium bug tracker and wiki which contain both "applescript" and "message" as substrings, this does not appear to be possible when using only AppleScript in Adium 1.0 through 1.3.10 (latest at time of writing). It seems to have been possible with plain AppleScript in Adium 0.89.1, but the volunteer developers are not yet convinced that adding this feature back is worth the effort.
To access the message content in AppleScript right now probably requires writing an Adium Xtra to forward the information. Examples of Xtra plugins that access the text of last message include Challenge/Response or SpamFilter. The sourcecode for SpamFilter is available on BitBucket, so you could conceivably modify it to send message contents to an AppleScript.
EDIT: Since I posted my response, user 'zostay' has spotted a new Adium Xtra called "Pipe Event". It allows sending the text of an event to a script in exactly the manner I envisioned when I wrote my second paragraph, so I'm up-voting zostay's answer. Sourcecode is also available.

Resources