Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

Alfred's "Email to..." feature no longer compatible with Mailmate

#825

Dear Benny

Alfred v2 has a neat feature to quickly attach a specified file to a new email: "Email to...". This feature uses the default mail client, and its integration with Mailmate is described in this Alfred Forum post.

For the last six months or so, this feature worked seamlessly: in the last fortnight or so it stopped working.
I am using:

  • OSX 10.9.3;
  • Mailmate Version 1.8 (4338) (although the problem was also present in 4158, from which I have just upgraded this morning); and
  • Alfred v2.3 (264).

The feature works correctly when:

  • Mail is the default mail client;
  • Airmail is the default mail client; and
  • Mailmate is the default mail client, and Mailmate is not running.

If I had to speculate, I'd guess that an update to Alfred was the cause of the problem, as I'm sure the feature was still working when I'd last upgraded Mailmate. Any help would be appreciated!

The relevant code, from "~/Library/Application Support/Alfred 2/Plugins/Email/MailMate.applescript", is pasted below.

-- 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, _attachments, _email, _name)
    
    set _to to _email
    if (_name is not "") then
        set _to to _name & " <" & _email & ">"
    end if
    set _mailto to "mailto:?to=" & url_encode(_to) & "&subject=" & url_encode(_subject) & "&body=" & url_encode(_body)
    
    repeat with _attachment in _attachments
        set _filePath to POSIX path of _attachment
        set _mailto to _mailto & "&attachment-url=file://" & url_encode(_filePath)
    end repeat
    
    return _mailto
    
end create_mailto

on send_email_with_attachment(ename, eemail, esubject, ebody, eattachment)
    
    set _mailto to create_mailto(esubject, ebody, eattachment, eemail, ename)
    tell application "MailMate"
        open location _mailto with trust
        activate
    end tell
end send_email_with_attachment

Kindest
Mike

Reported by Michael A Osborne · June 21st, 2014 @ 10:51 AM

State: new
Milestone: none
Assigned to: benny benny

Activity

  1. benny
    benny

    I don't see any obvious problems. I also tried taking the script and adding this line to test it:

    send_email_with_attachment("name", "email@example.com", "subject", "body", null)
    

    That seems to work too.

    Maybe compare with the scripts for the other email clients?

    (It's strange that it works when MailMate is not running...)

    June 23rd, 2014 @ 12:41 PM

  2. Michael A Osborne
    Michael A Osborne

    Many thanks for looking into this. The problem has, as of a restart today, seemed to disappear! I apologise for wasting your time; please do feel free to shut this down.

    June 23rd, 2014 @ 12:53 PM

  3. benny
    benny
    • State changed from new to resolved

    Let me know if you figure out what triggers the problem.

    June 23rd, 2014 @ 01:17 PM

  4. Michael A Osborne

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.