Closed Stinteg closed 4 years ago
hi @Stinteg welcome and thank you for your ticket. What version did you use ?
I just downloaded the latest version (v1.11.0) and it's still not matching on the second profile.
The second profile doesn't appear to match if I switch from "Subject" to "From" either.
This took me forever to figure out, too - the configuration file format is somewhat opaque.
I was able to get it to work with the following basic config file; Details redacted and some obvious settings omitted. Hope this helps!
[General]
...
[Logging]
...
[DefaultProfile]
[DefaultProfile.Mail]
ImapServer = "imap.mail.us-east-1.awsapps.com:993"
... (options)
[DefaultProfile.Mattermost]
URL = "https://our-mattermost-server-url.com"
Team = "our-global-team-name"
AccessToken = "access-token-for-our-global-mailbot"
...
[DefaultProfile.Filter]
(Our common e-mail filtering behavior for multiple imap accounts)
...
# here's profile 1
[[Profile]]
[Profile.Mail]
Username = "email-user-1-login"
Password = "email-user-1-password"
[Profile.Mattermost]
Channels = ["#channel-1"]
# here's profile 2
[[Profile]]
[Profile.Mail]
Username = "email-user-2-login"
Password = "email-user-2-password"
[Profile.Mattermost]
Channels = ["#channel-2"]
I'm using a single e-mail address and trying to differentiate by subject. I can't seem to figure out why this isn't be working.
[General]
File = "data.json"
RunAsService = true
TimeInterval = 10
[Logging]
Loglevel = "debug"
LogType = "text"
Output = "logfile"
Logfile = "mail2most.log"
[DefaultProfile]
[DefaultProfile.Mail]
ImapServer = “mail.mydomain.com:993"
Username = "mattermost"
Password = “xxxx”
ReadOnly = false
ImapTLS = true
VerifyTLS = false
Limit = 0
[DefaultProfile.Mattermost]
URL = "https://mmmsg.mydomain.com"
Team = “team1”
Username = "mattermost"
Password = “xxxxx”
Users = []
Channels = ["#mail2most"]
SubjectOnly = false
BodyOnly = true
StripHTML = true
ConvertToMarkdown = true
HideFrom = false
HideFromEmail = false
MailAttachments = true
[DefaultProfile.Filter]
Unseen = true
TimeRange = "24h"
IgnoreMailErrorNotifications = true
IgnoreDefaults = false
[[Profile]]
IgnoreDefaults = false
[Profile.Mattermost]
Channels = ["#on-call-calls"]
[Profile.Filter]
Subject = ["Account: 12345 mycompany”]
[[Profile]]
IgnoreDefaults = false
[Profile.Mattermost]
Channels = ["#event-notifications"]
[Profile.Filter]
Subject = [“company: Event Notification"]
SubjectOnly = true
HideFrom = true
HideFromEmail = true
MailAttachments = false
sorry for the long delays i hope to get a bit into this these days and make some tests.
@Stinteg i tested this with the following filters and it worked properly
[[Profile]]
IgnoreDefaults = false
[Profile.Mail]
[Profile.Mattermost]
Channels = ["#test"]
[Profile.Filter]
Subject = ["test"]
[[Profile]]
IgnoreDefaults = false
[Profile.Mail]
[Profile.Mattermost]
Channels = ["#test2"]
[Profile.Filter]
Subject = ["test2"]
SubjectOnly = true
HideFrom = true
HideFromEmail = true
MailAttachments = false
Hi, I have the same problem. I think it is because mail2most marks the mails as read, even if the filter does not apply.
If you want only new (unread) mails to be posted in Mattermost, you have to set the following
[Profiles.Mail]
# ReadOnly does not change any flags on emails
ReadOnly = false
Which causes the mails to be marked as read, if it has been processed. In connection with this the following settings must then be made:
[Profile.Filter]
Unseen = true
If you have two profiles which access the same mailbox, the problem occurs that the mails are marked as read although the filter does not apply. The consequence is that no more mail is retrieved from the second profile, because it has already been marked as read by the first profile.
The ReadOnly
flag controls the behavior when reading the mails since when set to true
no flags will change (if the mailserver implements the rfc correctly which is often not the case and the read only flag is ignored).
The Unseen
option parses the unseen
flag from the mail.
ReadOnly = true
and Unseen = true
should work als mail2most saves the information if a mail was already send since many mailservers mess around with their flags and its not trustfull to use them.
I know that this is a bit of an odd configuration since readonly and flags are a common problem since many mailservers did not implement the imap rfc correctly and sometimes ignore the readonly flag completely. The same is for mail flags since they are often not used correctly by the mailservers.
Oh ok, that's not a given. But perfect, now it works. Thanks!
I'll close this case for now, if this does not work for @Stinteg feel free to reopen
Setting "ReadOnly = true" and "Unseen = true" remedied the issue. We are now getting notifications from both profiles. Thanks!
Great! Thanks at this point to @blackde5ert for pointing this out. I added more description to the mail2most.conf for better understanding.
I'm sure I'm doing something wrong here, but no matter what I try, my second profile is never matching. I can move the profile order, and and the first one will always match, so I know both filters are able to match. I'm perplexed.
[[Profile]] IgnoreDefaults = false
[Profile.Mattermost] Channels = ["#calls"]
[Profile.Filter] Subject = ["Account: 12345"]
[[Profile]] IgnoreDefaults = false
[Profile.Mattermost] Channels = ["#notifications"]
[Profile.Filter] Subject = ["Event Notification"]