Jump to content

MailTo: Select multiple Contacts *and* Groups and compose in your favourite email app


Recommended Posts

I use Airmail and i was having problems with the "mailto" option. it was pulling the contact and plugging in <name <name@mail.com>> in the To: field. As this is not a valid e-mail address format I was having to change it manually. If you are having the same problem, I modified line 123 in the mailto.py code.

 

it should read:

 

return u'{}'.format(email)

 

this now places the correct format in the To: field

 

name <name@mail.com>

 

hope this helps someone.

 

 

 

Link to post
  • Replies 161
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

2015-07-29: Version 2 released   MailTo: Select multiple Contacts and/or Groups, and compose in your favourite email app   Search your Contacts and compose an email to one or more recipients (or none)

Updated again today with new configuration/help keywords to stop them getting mixed up with the contact search results.

Alfred is already incredibly helpful on its own, but workflows such as yours make it even more unbelievable. Thanks for your work! Just wondering if there's a way to segregate emails by To: Cc: and B

Posted Images

0.1642 seconds is pretty fast when you're running a shell script once, but Alfred calls it (if it can) every time you type a letter. In those terms, it's really rather slow. (And it runs much slower still when Alfred is calling it to search for just one or two letters.)

 

By way of comparison, using a query that takes a similar length of time on my computer (0.1541 s), the original workflow's search takes 0.002 s, and it's doing more work (searching groups, too).

 

I've made a test workflow for the all-accounts search here. Give it a try and see what you think of the performance.

 

I'll work on speeding it up as much as I can, but if I can't get it at least 10-20x faster, I'll make it an option/separate workflow.

 

It is a little slower but I don't mind personally just because it does what I need. Others may disagree though. I did my best to show you the speed without showing you my contacts' details:

 

http://cl.ly/1I2t1l3K251m

Link to post

I use Airmail and i was having problems with the "mailto" option. it was pulling the contact and plugging in <name <name@mail.com>> in the To: field. As this is not a valid e-mail address format I was having to change it manually. If you are having the same problem, I modified line 123 in the mailto.py code.

 

it should read:

 

return u'{}'.format(email)

 

this now places the correct format in the To: field

 

name <name@mail.com>

 

hope this helps someone.

 

The problem is a known one.

 

There's no need to change the code, just run mailtoconfig in Alfred and either specifically set Airmail as your client (the workflow knows Airmail only accepts email addresses, no names) or change the format to Email Only.

 

This is no longer true. The workflow can now discover which email client you have set as system default and adjust its output accordingly.

 

Note: the workflow will still send Name and Email if you've specifically set that format.

 

I've updated the original post to draw attention to this problem.

Edited by deanishe
Link to post

It is a little slower but I don't mind personally just because it does what I need. Others may disagree though. I did my best to show you the speed without showing you my contacts' details:

 

http://cl.ly/1I2t1l3K251m

 

I'll see what I can do. Thing is, it's going to get slower: it needs to search groups, too, which it isn't currently doing.

 

Ideally, I'd be able to cache the contacts database like I do now, but it takes 3–5 seconds to load all contacts this way vs 0.05 seconds the current way.

Link to post

*bump*

 

Another update. No new features as such, but now recognises which email client you're using (i.e. no need to set one in the workflow), and comes with fairly robust support for most of the popular Mac email clients. That is to say, no more problems with Airmail, MailMate or contacts with commas or diacritics in their names.

 

If your email client of choice isn't listed in the OP and/or isn't working properly, please let me know.

 

Obviously, that applies to problems with listed email clients, too  ;)

Link to post

I use Airmail and i was having problems with the "mailto" option. it was pulling the contact and plugging in <name <name@mail.com>> in the To: field. As this is not a valid e-mail address format I was having to change it manually. If you are having the same problem, I modified line 123 in the mailto.py code.

 

it should read:

 

return u'{}'.format(email)

 

this now places the correct format in the To: field

 

name <name@mail.com>

 

hope this helps someone.

 

Fairly hefty update today. Any and all problems with Airmail should be things of the past.

Link to post
  • 2 weeks later...

Fairly hefty update today. Any and all problems with Airmail should be things of the past.

This is a wonderful workflow.

 

What would be extra specially great would be to select the account it was being sent from. I have 3 email addresses I use so it would be great to say "mailto paul with acct1name"

 

Is this possible?

Link to post
  • 4 weeks later...

If you're still worried about speed on the Exchange contacts query, then consider putting in a minimum number of characters to search before the script filter "fires." I.e. if the "argument" has fewer than three characters, return some xml that says "type more characters to search" or something. Then it won't grab quite as many results (results for the "t" would be much bigger and slower than "tom"), and it won't get caught up doing those first two searches, making the overall thing faster.

 

If you want to get much, much fancier, then you could consider caching the query results for some amount of time.

Link to post

nothing is happening with me. I downloaded the file double click to install and try it but I don't know what is going on it just shoots me to a blank webpage (I'm using Safari) any help.

 

I just downloaded the workflow myself using Safari and it installed just fine. Could you verify that you're downloading a file called "MailTo.alfredworkflow" that is 197 KB in size?

Link to post

If you're still worried about speed on the Exchange contacts query, then consider putting in a minimum number of characters to search before the script filter "fires." I.e. if the "argument" has fewer than three characters, return some xml that says "type more characters to search" or something. Then it won't grab quite as many results (results for the "t" would be much bigger and slower than "tom"), and it won't get caught up doing those first two searches, making the overall thing faster.

 

If you want to get much, much fancier, then you could consider caching the query results for some amount of time.

 

The problem is that even with 3+ character queries, search takes ~0.2 seconds, which I consider to be unacceptably slow. I imagine a lot of people have significantly more contacts than I do, too.

 

At the moment I'm experimenting with re-writing the workflow in Objective-C to get full speed out of the native API. Unfortunately, it's still a lot slower than the current implementation and the search is far more rudimentary.

 

Are there any volunteers who I could send a proof-of-concept version to, so they can confirm whether it works with Exchange contacts, too? The Apple API docs say:

 

 

Note: You can only search the user’s local Address Book database, not remote directories such as CardDAV or Exchange.

 

However, Jb_Bryant reported that his Exchange contacts were showing up in the Python version that uses the official API (via a bridge).

Edited by deanishe
Link to post

Would there be any way to use Gmail in Chrome as the default method with this workflow? That way I could use Outlook as my default system-wide and use the built in contact search in Alfred for that. And then use this workflow to send through Gmail since all of my iCloud and Gmail contacts show up with this workflow.

Link to post

I see now that in your original post it says it should work if you choose Chrome as the mail client. That didn't work in the old workflow. It would just open up a blank tab in Chrome. I just upgraded to the latest version and it actually doesn't work at all. I type mailtoclient, hit enter, and it goes to my fallback google search.

Link to post

To enable Gmail, open it in Chrome and hit the overlapping squares icon in the location bar.

 

With regard to the configuration problem, could you open the workflow directory in Terminal and run:

python mailto.py client

If you could PM me the output, I can try to fix it.

 

If there is no output, run:

python mailto.py logon

Then once more:

python mailto.py client

And finally:

python mailto.py openlog

And PM me the contents of the log instead.

Link to post

The plutil parsing of com.apple.LaunchServices.plist fails on my system with an error "invalid object in plist for destination format". My file contains a '<data>' field for the LSHighResolutionModeIsMagnified key.

 

Had a poke around, and it looks like exporting the plist as XML, not JSON, should fix the problem. I'll try and get that changed tomorrow (well, later today, I guess) and upload a new version.

 

Thanks for the testing and explicit error message. It was very helpful.

Link to post
  • 1 month later...

Is there any update on this? I really need this workflow really bad. Here's my output if it helps.

 python mailto.py client

Traceback (most recent call last):
  File "mailto.py", line 62, in <module>
    from contacts import get_contacts, CACHEPATH
  File "/Users/G/Dropbox/Alfred2/Alfred.alfredpreferences/workflows/user.workflow.7E8973CB-6BB8-4137-B64E-1480BAE6661E/contacts.py", line 29, in <module>
    log = logger(u'contacts')
  File "/Users/G/Dropbox/Alfred2/Alfred.alfredpreferences/workflows/user.workflow.7E8973CB-6BB8-4137-B64E-1480BAE6661E/log.py", line 24, in logger
    s = Settings()
  File "/Users/G/Dropbox/Alfred2/Alfred.alfredpreferences/workflows/user.workflow.7E8973CB-6BB8-4137-B64E-1480BAE6661E/settings.py", line 49, in __init__
    self._load()
  File "/Users/G/Dropbox/Alfred2/Alfred.alfredpreferences/workflows/user.workflow.7E8973CB-6BB8-4137-B64E-1480BAE6661E/settings.py", line 60, in _load
    self['system_default_app'] = self._get_system_default_client()
  File "/Users/G/Dropbox/Alfred2/Alfred.alfredpreferences/workflows/user.workflow.7E8973CB-6BB8-4137-B64E-1480BAE6661E/settings.py", line 75, in _get_system_default_client
    d = json.loads(check_output(command))
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 575, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '[u'plutil', u'-convert', u'json', u'-o', u'-', u'/Users/G/Library/Preferences/com.apple.LaunchServices.plist']' returned non-zero exit status 1

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...