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.

External email warning should be configurable per account

#500

I would like to use the Warn about external recipients hidden preference, but I find its scope too broad. Here's my use case: I have as an example two accounts: Personal and Work. I want a (optional) per-account warning regex. When I mail from work, I want to know if I'm accidentally sending to someone outside of work. However, from my personal account I don't want warnings enabled at all.

I'd propose changing the setting to a dictionary where the keys are regular expressions matching the From address of the mail being sent and the values are regular expressions for checking recipient addresses. If multiple 'From' keys match the current sender, the OR of their regexes would be used when matching recipient addresses.

Example

Maybe you set the default with something like:

    defaults write com.freron.MailMate MmInternalRecipients -dict '@my-work.com' '@my-work.com' \
                                                                  '@my-play.com' '@gmail.com' \
                                                                  'work.com' '@freron.com'

If I compose a mail from jon@my-work.com, I'll get a warning unless every recipient matches either @my-work.com or @freron.com

If I compose a mail from jon@my-play.com, I'll get a warning unless every recipient matches @gmail.com

If I compose a mail from jon@my-other.com, I'll never see the recipient warning shown since there's no entry for it.

Reported by nall · November 23rd, 2013 @ 04:33 PM

State: fixreleased
Milestone: none
Assigned to: benny benny

Activity

  1. benny
    benny
    • State changed from new to accepted

    I get the idea and it's very flexible although perhaps a bit complex, but I guess that's fine as long as a single regular expression also works (which is probably already too complicated for most users anyways).

    I'll look into how hard it would be to improve.

    May 21st, 2014 @ 07:51 PM

  2. nall
    nall

    Are you able to switch on the type of the value? Power users could use a dictionary like I described. Non-power users could use a simple string like the current implementation.

    May 21st, 2014 @ 09:21 PM

  3. benny
    benny
    • State changed from accepted to fixcommitted

    I could do that, but if I ever add a GUI for this feature then it wouldn't really be the ideal way to do this. I've taken a different route which is not quite as flexible as your dictionary, but it's close:

    • Quit MailMate
    • Edit ~/Library/Application Support/MailMate/Identities.plist
    • Add key/value pairs similar to these to one or more of the identities:

      internalAddressPattern = ".*@freron\\.com";
      internalAddressPatternEnabled = 1;
      

    Based on the from address MailMate finds the identity and uses the identityAddressPattern to analyze the recipient addresses. If no pattern exists for the identity then nothing happens (except if MmInternalRecipients is defined which is still used as a fall back).

    This is going to be part of the next update which I don't have a release date for yet. Let me know how it works for you.

    (This is not as flexible as your solution since you cannot define multiple patterns for the email addresses of a single account. The “system” is prepared for allowing multiple identities for a single account and this could make the solutions equal, but I don't really have any plans to add a GUI for that.)

    May 23rd, 2014 @ 10:04 AM

  4. benny
    benny

    If you feel adventurous then here is a direct link to the latest test version: http://updates.mailmate-app.com/archives/MailMate_r4249.tbz

    It might be unstable for other reasons since I've made some major changes only tested by me for a day or so.

    May 23rd, 2014 @ 08:21 PM

  5. nall
    nall

    Benny,
    Looks good, thanks!

    1 question: Is there any chance of turning the address in the To:/Cc: field, red like Mail.app if the internalAddressPattern doesn't match? Having that early visual heads up is nice.

    May 29th, 2014 @ 04:06 AM

  6. benny
    benny

    The red color of a token is only available to Apple Mail. It's not a documented feature in the API. I could use it anyways, but I prefer not to. Instead I've changed the visualization of tokens such that external addresses are prefixed with a red exclamation mark (Unicode symbol). These are updated whenever changing the from address. Seems to work quite well.

    June 8th, 2014 @ 02:20 PM

  7. nall
    nall

    Just tried it. Looks great. Thanks!

    nall.

    June 9th, 2014 @ 02:50 AM

  8. benny
    benny
    • State changed from fixcommitted to fixreleased

    October 15th, 2014 @ 03:32 PM

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.