lajlev Posted May 9, 2016 Share Posted May 9, 2016 I use Nylas email client. When I use the build-in function to send email through my default client (https://i.imgur.com/QNHsfIB.png), it works fine in Nylas (https://i.imgur.com/wxykDqo.png). But when I want to email selected file (https://i.imgur.com/WZ2e7Uj.png), it don't use my set default email client but opens the native mail app (https://i.imgur.com/eDsMlNR.png). Is this a known bug? Link to comment
Vero Posted May 9, 2016 Share Posted May 9, 2016 I use Nylas email client. When I use the build-in function to send email through my default client (https://i.imgur.com/QNHsfIB.png), it works fine in Nylas (https://i.imgur.com/wxykDqo.png). But when I want to email selected file (https://i.imgur.com/WZ2e7Uj.png), it don't use my set default email client but opens the native mail app (https://i.imgur.com/eDsMlNR.png). When simply sending an email, Alfred uses mailto: and lets OS X use the default mail client. Meanwhile, when attaching files, some AppleScript is required, so we include support for the most common email clients, and allow you to add custom scripts for other clients. I've not heard of Nylas before, but if it supports AppleScript, you should be able to create your own script (or ask friendly people on the forum to help you out) and drop it here: ~/Library/Application Support/Alfred 2/Plugins/Email/ You'll then be able to use that mail client as your default client for attaching files. I'll move this to Discussion & Help so that others can see it & help you with your script if needed Cheers, Vero Link to comment
aberlee Posted June 22, 2016 Share Posted June 22, 2016 I would be very interested to see how this would work. I've installed a plugin that should redirect mailto: links to gmail, (in safari, my browser) but I have no clue how to create an applescript to add to the ~/Library/Application Support/Alfred 2/Plugins/Email/ folder.... any help would be much appreciated Link to comment
deanishe Posted June 22, 2016 Share Posted June 22, 2016 Your best bet is to look at an existing plugin and try to adapt that to your email program. The precise implementation will depend on your email program's API, however. Link to comment
vitor Posted June 22, 2016 Share Posted June 22, 2016 As a small note, it is extremely unlikely Nylas supports AppleScript, since it is based on Electron. Link to comment
deanishe Posted June 22, 2016 Share Posted June 22, 2016 As a small note, it is extremely unlikely Nylas supports AppleScript, since it is based on Electron. Hurrah for webdevs and their inability to learn anything more complicated that JavaScript! Neberheim 1 Link to comment
Gaetano Posted July 24, 2016 Share Posted July 24, 2016 Your best bet is to look at an existing plugin and try to adapt that to your email program. The precise implementation will depend on your email program's API, however. May you point us to one of such existing plugins, I would really appreciate it, thank you Link to comment
deanishe Posted July 24, 2016 Share Posted July 24, 2016 Try looking in Alfred's data directory on your machine. I think there may be a bundled one. The ones posted on the forum disappeared because the fella who wrote them (David) hosted them on Droplr or something else temporary. It's possible they've been re-hosted. If you can't find one, I'll paste the one I have here (I'm not at my computer right now). Link to comment
samlimster Posted September 12, 2017 Share Posted September 12, 2017 Hi folks. I'm curious as to how to set this up as well. I'm using Spark as my default email client and would love to be able to select a file in finder and email it off using alfred's Actions. I looked in my plugins folder and there are no bundled plugins for my alfred 3 installation. Thank you! sam. Link to comment
deanishe Posted September 12, 2017 Share Posted September 12, 2017 4 hours ago, samlimster said: I'm using Spark as my default email client The first question to answer is whether Spark actually provides a mechanism to programatically add attachments (via AppleScript or a URL scheme etc.). If it doesn't, you can forget about it. Link to comment
samlimster Posted September 12, 2017 Share Posted September 12, 2017 Ah.. thanks for the reply, @deanishe I just saw another thread where they said that spark doesn't support applescript. Link to comment
Shana601 Posted January 13, 2018 Share Posted January 13, 2018 On 9/12/2017 at 6:01 PM, deanishe said: The first question to answer is whether Spark actually provides a mechanism to programatically add attachments (via AppleScript or a URL scheme etc.). If it doesn't, you can forget about it. When I use mail.app search workflow, if I use spark as the application to open a file, the file becomes an attachment in spark. Not sure if that's something related or helpful at all. I'm new to Alfred workflow. Link to comment
Shana601 Posted January 13, 2018 Share Posted January 13, 2018 Here is what I just created. It's a simple file action. Hope it can be a little helpful. https://github.com/Shana601/Alfred-Mail-with-Spark deanishe 1 Link to comment
deanishe Posted January 13, 2018 Share Posted January 13, 2018 Nice one, @Shana601. Regarding Alfred 2: no the workflow is not compatible. Any workflow created (or edited) in Alfred 3 becomes incompatible with Alfred 2, regardless of whether Alfred 2 supports the required features or not. Link to comment
GuiB Posted January 14, 2018 Share Posted January 14, 2018 (edited) I was intrigued by how to create an email plugin, so I had a look to create one for Spark... Here's what I've found to be the most robust way to make it work with Alfred. In short, I'm combining the script for MailMate found here and @Shana601 way by opening files in Spark (using a do shell script since it seemed to be more robust than the applescript open). I've found that multiple opening of files append the files to the attachment. Therefore, I'm opening a mailto: link to set the emails, subject and body and then another open for the files to be attached. Here is the file/plugin to put into your "~/Library/Application Support/Alfred 3/Plugins/Email/" folder: https://d.pr/f/jSrHh3 Here is the script: -- Use Spark as default email application with Alfred -- Based on MailMate plugin script: https://www.alfredforum.com/topic/2354-add-support-for-mailmate-email-client/ -- Send an email with an attachment on url_encode(theText) return do shell script "printf " & quoted form of theText & " | xxd -u -plain | sed 's/\\(..\\)/%\\1/g' | tr -d '\\n'" end url_encode on create_mailto(_subject, _body, _email, _name) set _to to _email if (_name is not "") then set _to to _name & " <" & _email & ">" end if return "mailto:?to=" & url_encode(_to) & "&subject=" & url_encode(_subject) & "&body=" & url_encode(_body) end create_mailto on send_email_with_attachment(ename, eemail, esubject, ebody, eattachment) set _mailto to create_mailto(esubject, ebody, eemail, ename) tell application "Spark" activate open location _mailto with trust end tell repeat with attachment in eattachment do shell script "open -a Spark \"" & attachment & "\"" end repeat end send_email_with_attachment Edited July 17, 2019 by GuiB Updated download link Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now