• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
AppleScript to send Mail using Mail.app
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AppleScript to send Mail using Mail.app


  • Subject: AppleScript to send Mail using Mail.app
  • From: Infosys Deepak <email@hidden>
  • Date: Mon, 21 Sep 2009 13:22:23 +0530

Hi,

To send message using apple script, I am currently using the below script on Leopard

Here, I will have to specifically copy the message to Send mailbox before moving it to outbox for delivery. This also results in keeping the mail in the local sent items folder and not on the email server. Also, it will sometime result in incomplete save. 

Is there a better workaround for making the mail appear in the sent items during delivery ?

Also, is there a better workaround instead of enabling/disabling the account for message delivery ?

tell application "Mail"
set theAccount to accounts
set theMailbox to mailbox "Drafts" of account theAccount
set theMessageList to messages of theMailbox


repeat with eachMessage in theMessageList

// Here, I will get the reference to the EMLX file and modify the contents before
        // sending the mail.  

set read status of eachMessage to true
copy eachMessage to mailbox "Sent" of theAccount
delay 0
move eachMessage to mailbox "Outbox"
end repeat


tell theAccount
if enabled then
set enabled to false
delay 1
set enabled to true
end if
end tell


end tell

Thanks,
Deepak
 _______________________________________________
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

  • Prev by Date: Re: do shell script "command not found"
  • Next by Date: Re: do shell script "command not found"
  • Previous by thread: Re: do shell script "command not found"
  • Next by thread: iTunes "Manually Manage Music and Videos" property
  • Index(es):
    • Date
    • Thread