The Applescript below is in the form that I have used for a number of years. And is basically a well known method of sending emails using Applescript.
tell application "Mail"
set newMessage to make new outgoing message with properties {subject:"IP Address", content:"Your IP Address Is: 86.195.132.134"}
tell newMessage
set visible to false
set sender to "[email protected]"
make new to recipient at end of to recipients with properties {address:"[email protected]"}
send
end tell
end tell
What I just noticed today is the 'sender' email set in the script, may not be the one Mail.app uses if its account mail box is not selected. A random one will be used if the main inbox is selected or if an individual mailbox is selected then an address from it's account will be used.
I think this is because in the Mail preferences, under Composing. There is a setting to 'Send new messages from:'
You cannot select 'NO'. The only options are 'Account of selected mailbox' or one of the email addresses that are in the combo box drop down.
I must admit I do not know if this was been happening before I went to Lion.
Does anyone know of a fix for this, or if this is a known bug??.
Thanks.
this worked for me just now, hope it helps:
tell application "Mail"
set theOutMessage to make new outgoing message with properties {visible:true}
tell theOutMessage
make new to recipient at end of to recipients with properties {address:"[email protected]"}
set sender to "Name Surname <[email protected]>"
set subject to "Message Subject"
set content to "Message Text"
end tell
end tell
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With