Re: Sending mail w/attachment from Terminal
Re: Sending mail w/attachment from Terminal
- Subject: Re: Sending mail w/attachment from Terminal
- From: "S. J. Cunningham" <email@hidden>
- Date: Tue, 28 Feb 2017 14:58:20 -0500
On Feb 28, 2017, at 2:26 PM, debt wrote:
> Is there a way to send an email with an attachment from the Terminal using AppleScript?
>
> At present, I have a script that sends them via Mail, but the Mac is unattended and every so often, Mail pops up a modal dialog asking for the password. Once that happens, nothing gets sent out until I’m able to get there and dismiss the dialog box.
>
> If the command line is not the proper place to do this sort of thing, what would you suggest?
>
That is a common and known problem with Mail. It occurs because the server doesn't respond fast enough and Mail interprets that as a password failure. It is extremely frustrating when it happens and I have never figured any way around it except to wait for the server to right itself. Also, if I recall, there is no way to determine if Mail has actually sent a message via an applescript command because it returns "success" even if the send fails, In that case, it just puts it in the outbox and is pleased with itself.
Maybe you could check some time after a "send" to see if the message is still in the outbox. If so, you could kill mail and relaunch to clear the dialog. There may also be some way to do it with GUI scripting but that's probably a lot more complicated.
Steve
------------------
OS X 10.6.8, AppleScript 2.1.2
Takes a Lickin' and Keeps on Tickin'!
_______________________________________________
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