GithubHelp home page GithubHelp logo

rodcorsi / mattermail Goto Github PK

View Code? Open in Web Editor NEW
147.0 18.0 29.0 44.99 MB

Email Integration for Mattermost

License: BSD 3-Clause "New" or "Revised" License

Go 96.92% Makefile 3.08%
mattermost golang email integration imap

mattermail's People

Contributors

banzo avatar bhaskard avatar devseevali avatar golint-fixer avatar kometaku avatar miniconfig avatar rodcorsi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mattermail's Issues

MailTemplate same as Original

Hello,

At the moment i'm testing the Mattermost-Server with Mattermail for a Business Partner, but the issue is following:

My Business Partner sends Mails with Roundcube-Webmail with Attachments. This Attachments are insert by Drag&Drop. In the Roundcube-Webmail-App i can see the Attachments in the Mail, but not with an Attachment-Flag. Without this Flag Mattermail don't post the Attachments in Mattermost.

In my Mattermail-Installationpath i have only the 2 Files "config.json" and "mattermail" (App).

Here is my config.json (without real IP-adress and Passwords):
`[
{
"Name": "Mattermost",
"Server": "http://my-ip-adress:8065",
"Team": "makom",
"Channel": "#town-square",
"MattermostUser": "mattermail",
"MattermostPass": "myPassword",
"ImapServer": "my-imap-server.de:993",
"Email": "[email protected]",
"EmailPass": "myPassword",
"MailTemplate": ":incoming_envelope: From: %v\n>%v\n\n%v",
"StartTLS": true,
"Disabled": false,
"Debug": true,
"LinesToPreview": 100,
"NoRedirectChannel": false,
"NoAttachment": false,
"Filter": []

}

]`

It is possible to import the Mails from the Webaccount into Mattermost without the MailTemplate in the config.json, so that Mattermail posts the original Mail with and not a Preview with attachments?

Best regards

Steve Herbst

Option for Accepting all TLS Certs

At the moment if you have a self signed cert on an email server you can't connect through TLS. I set the StartTLS:true in config.json and get this error:

IMAP Emails 17:51:23 TLS handshake failed (x509: cannot validate certificate for x.x.x.x because it doesn't contain any IP SANs)

There is an option in imapClient.StartTLS() to set a config:
https://godoc.org/github.com/mxk/go-imap/imap#Client.StartTLS

The code only sets nil, I think it would work with:
https://godoc.org/crypto/tls#Config

Specifically this option:
InsecureSkipVerify bool

Could I request a config option for this? I will try and see if I can program this myself however Go is new to me.

Thanks.

Answer Mails

After getting mattermail to run, im pretty satisfied with it, the only thing I'm missing is a feature to answer Mails and write Mails (like Mailclark for Slack (https://mailclark.ai/help/simple)).

Would it be possible to add this as a feature?

Filter stop working

Hello,

Filters don't works for me on mattermost 3.3.0:

Config:

[
{
"Name": "SVN-Test",
"Server": "https://mattermost.test.com",
"Team": "trololo",
"Channel": "#n1portal",
"MattermostUser": "svcacc",
"MattermostPass": "123",
"ImapServer": "webmail.huehue.com:993",
"Email": "[email protected]",
"EmailPass": "blablabla",
"MailTemplate": ":incoming_envelope: From: %v\n>%v\n\n%v",
"StartTLS": false,
"Disabled": false,
"Debug": true,
"LinesToPreview": 20,
"NoRedirectChannel": true,
"NoAttachment": true,
"Filter": [
{
"Subject":"work",
"Channel": "#n1portal"
}
]
}
]

LOG:

IMAP SVN-Test 20:03:16 S: * 1 RECENT
IMAP SVN-Test 20:03:16 C: DONE
IMAP SVN-Test 20:03:16 S: * 108 EXISTS
IMAP SVN-Test 20:03:16 S: MVWJN8 OK IDLE completed.
DEBG SVN-Test 20:03:16 CheckNewMails
DEBG SVN-Test 20:03:16 CheckImapConnection: Connection alive
IMAP SVN-Test 20:03:16 C: MVWJN9 SELECT "INBOX"
IMAP SVN-Test 20:03:16 S: * 108 EXISTS
IMAP SVN-Test 20:03:16 S: * 0 RECENT
IMAP SVN-Test 20:03:16 S: * FLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)
IMAP SVN-Test 20:03:16 S: * OK [PERMANENTFLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)] Permanent flags
IMAP SVN-Test 20:03:16 S: * OK [UNSEEN 108] Is the first unseen message
IMAP SVN-Test 20:03:16 S: * OK [UIDVALIDITY 14] UIDVALIDITY value
IMAP SVN-Test 20:03:16 S: * OK [UIDNEXT 123] The next unique identifier value
IMAP SVN-Test 20:03:16 S: MVWJN9 OK [READ-WRITE] SELECT completed.
IMAP SVN-Test 20:03:16 C: MVWJN10 UID SEARCH CHARSET UTF-8 UNSEEN
IMAP SVN-Test 20:03:16 S: MVWJN10 NO [BADCHARSET (US-ASCII)] The specified charset is not supported.
DEBG SVN-Test 20:03:16 Error UIDSearch UTF-8:
DEBG SVN-Test 20:03:16 imap: unexpected completion status ("MVWJN10 NO [BADCHARSET (US-ASCII)] The specified charset is not supported.")
DEBG SVN-Test 20:03:16 Try with US-ASCII
IMAP SVN-Test 20:03:16 C: MVWJN11 UID SEARCH CHARSET US-ASCII UNSEEN
IMAP SVN-Test 20:03:16 S: * SEARCH 122
IMAP SVN-Test 20:03:16 S: MVWJN11 OK SEARCH completed.
DEBG SVN-Test 20:03:16 CheckNewMails:AddNum 122
IMAP SVN-Test 20:03:16 C: MVWJN12 UID FETCH 122 (BODY[])
DEBG SVN-Test 20:03:16 CheckNewMails: cmd in Progress
IMAP SVN-Test 20:03:16 S: * 108 FETCH (BODY[] {3273}
IMAP SVN-Test 20:03:16 S: literal 3273 bytes
IMAP SVN-Test 20:03:16 S: UID 122 FLAGS (\Seen))
DEBG SVN-Test 20:03:16 CheckNewMails:PostMail
DEBG SVN-Test 20:03:16 &{https://mattermost.test.com https://mattermost.test.com/api/v3 0xc42042fcb0 }
DEBG SVN-Test 20:03:16 Login user:svcacc team:trololo url:https://mattermost.test.com
INFO SVN-Test 20:03:16 Post new message
DEBG SVN-Test 20:03:16 Did not find channel/user from Email Subject. Look for filter
DEBG SVN-Test 20:03:16 Did not find channel/user in filters. Look for channel '#n1portal'
DEBG SVN-Test 20:03:16 Post email in #n1portal
DEBG SVN-Test 20:03:16 CheckNewMails: cmd in Progress
IMAP SVN-Test 20:03:16 S: MVWJN12 OK FETCH completed.
DEBG SVN-Test 20:03:16 CheckNewMails: Mark all messages with flag \Seen
IMAP SVN-Test 20:03:16 C: MVWJN13 UID STORE 122 +FLAGS.SILENT \Seen
IMAP SVN-Test 20:03:16 S: MVWJN13 OK STORE completed.
DEBG SVN-Test 20:03:16 IdleMailBox
DEBG SVN-Test 20:03:16 CheckImapConnection: Connection alive
IMAP SVN-Test 20:03:16 C: MVWJN14 SELECT "INBOX"
IMAP SVN-Test 20:03:16 S: * 108 EXISTS
IMAP SVN-Test 20:03:16 S: * 0 RECENT
IMAP SVN-Test 20:03:16 S: * FLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)
IMAP SVN-Test 20:03:16 S: * OK [PERMANENTFLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)] Permanent flags
IMAP SVN-Test 20:03:16 S: * OK [UIDVALIDITY 14] UIDVALIDITY value
IMAP SVN-Test 20:03:16 S: * OK [UIDNEXT 123] The next unique identifier value
IMAP SVN-Test 20:03:16 S: MVWJN14 OK [READ-WRITE] SELECT completed.
IMAP SVN-Test 20:03:16 C: MVWJN15 IDLE
IMAP SVN-Test 20:03:16 S: + IDLE accepted, awaiting DONE command.

Should receive post in mattermost channel n1portal if content of subject is "work", but i received all messages from any subjects. See Attachment
mattermost

Mattermost Version: 3.3.0

Regards,

Luiz.

certificate error (x509)

Hi,

I'm currently working on a prototype of Mattermost and Mattermail for our company and I want to use the Mattermail plugin. But when I try to connect to our internal mail server I'm getting the follwing error:

DEBG 12:21:20 Debug mode on
INFO 12:21:20 Checking new emails
DEBG 12:21:20 CheckNewMails
DEBG 12:21:20 CheckImapConnection: DialTLS
IMAP 12:21:20 Connected to {IP}:993 (Tag=LKFEH)
IMAP 12:21:20 S: (x509: certificate signed by unknown authority)
IMAP 12:21:20 Close reason: protocol error
IMAP 12:21:20 Connection closing (flush=false)
IMAP 12:21:20 Greeting error: x509: certificate signed by unknown authority
EROR 12:21:20 Unable to connect: x509: certificate signed by unknown authority
INFO 12:21:20 Error on check new email: x509: certificate signed by unknown authority

I've already applied the certificate in my local storage and it was added as expected.

sudo dpkg-reconfigure ca-certificates
Trigger für ca-certificates (20170717~16.04.1) werden verarbeitet ...
Updating certificates in /etc/ssl/certs...
2 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...
done.

On the other hand, I've tried to set the switch 'TLSAcceptAllCerts' to 'true' but I looks like that this does nothing. The whole config looks like (removed personal parts):

[
{
"Name": "{name}",
"Server": "http://{IP}:8065",
"Team": "{TEAM}",
"Channel": "#{CHANNEL}",
"MattermostUser": "admin",
"MattermostPass": "{ADMPASS}",
"ImapServer": "{IMAP-SRV:PORT}",
"Email": "{MAIL}",
"EmailPass": "{PASS}",
"MailTemplate": ":incoming_envelope: From: %v\n>%v\n\n%v",
"StartTLS": true,
"TLSAcceptAllCerts": true,
"Disabled": false,
"Debug": true,
"LinesToPreview": 20,
"NoRedirectChannel": true,
"NoAttachment": true,
"Filter":[
{"From":"", "Subject":" ", "Channel":"#CHANNEL"}
]
}
]

The Mattermail version that I use is: 3.5.0
The Mattermost version that I use is: 4.2.0

Any help is much appreciated! If you need anything else, please do let me know.
Thank you.

No "Channel Handles" in latest version of Mattermost

I have Mattermost version 3.4.0. It doesn't show a Channel Handle in the Channel info screen like in the screenshot in Usage step 2 of README.md. It shows a URL in the format http://server/team/channels/lower-kebab-case-channel-name and the channel ID.

I assume that last portion of the url is the Channel Handle. I don't have Mattermail installed yet so I can't confirm. The README should be updated accordingly.

Also, do you support specifying a channel by ID?

Support for different teams

It would be very useful to have a feature to send mails to different teams having a similar syntax in the subject as for channels or users. Like: [!team2][#some_channel] My subject
At the moment it needs one mail account for each team. In our use case we have one mail account in the organization to forward mail to Mattermost. But we have different projects using their own teams.

Leave Unread on Server?

Is there any way of leaving the email unread on the server, or is that the only way mattermail is tracking which emails it's pushed? I'm just testing this out at the moment for a shared inbox, and this is causing a bit of a problem.

2.2 Release for LinuxAmd64 not available, go building fails

Dear authors,

I am trying to set up mattermail to use it together with Mattermost2.2.
Unfortunately, the link to the 2.2 release does not work and I am running into errors while trying to compile the 2.2 version directly. E.g. with Go 1.6.1 I am getting the following error message:
go install

mattermail-2.2

./mattermail.go:248: client.LoginByEmail undefined (type *model.Client has no field or method LoginByEmail)
./mattermail.go:311: client.UploadFile undefined (type *model.Client has no field or method UploadFile, but does have model.uploadFile)

While with go1.2.1to go1.5 I am getting the following error:
package runtime/debug: unrecognized import path "runtime/debug"

I would be glad if you could recommend a go version or upload a release version 2.2.

Thanks in advance

Marco

Support IMAP over SSL

Hello,
I would like to use MatterMail with Gmail, but Gmail not supporting IMAP.
Is this possible - use MatterMail with Gmail?

Thanks for this plugin.

Add configuration option for RegExp for Redirect Channel

I have the following problem:
Sometimes we have larger incidents in our ticketssystem that we want to chat about.
Therefore I want to add emails from our ticketsystem to the chatroom that is corresponding with the ticket number.

Our ticketsystem creates emails with the subject tag "[Orgname#0123456789] subject"
Mattermail will forward an email with such an subject neither to the channel #0123456789 nor to "Orgname#0123456789" as it excpects a "[#" in the subject.

I could fork mattermail and remove the "[" from the check. I already saw that at least one forked mattermail for just a similar reason. But then my fork will be not benefit from further updates.

Therefore my request:
Could you make the RegExp a variable that can be editied in the config file?
If I am correct it is just this line in your code:
https://github.com/rodcorsi/mattermail/blob/master/mmail/mattermail.go#L425

Remove validation of email address to accept Username

Hi,
Some email solutions like Microsoft require you to log in with a Username instead of a full email address.
They are either just or <DOMAIN\username>
Sometimes also the User Principal Name ([email protected]) is possible, but not on every system.
In addition, local domains not always use common TLDs. Instead something like .local .internal is common.

Regards,
Jonas

Get Mails with Pop3

Hi there,

it would be amazing, if you could get the Mails via POP3, so the Mails will bedeleted from the Relay-Mailbox after Mattermail took them.

Regards

How to install mattermail

Hey,

I wanted to install mattermail in our mattermost envriomnent and test it but run in to several issues. The documentation on how to install mattermail isn't really clear to me.

I downloaded the mattermail-3.0.13.linux.am64.tar.gz into my /opt folder and unziped the mattermail file and the config.json in that folder. Then I run into this:

root@mattermost:/opt# ./mattermail > /var/log/mattermail.log 2>&1
root@mattermost:/opt# ./mattermail
2016/10/06 15:46:04 Loading  ./config.json
2016/10/06 15:46:04 Could not parse: invalid character '/' looking for beginning of object key string

Something I'm missing here already?
My didn't change the config.json file for now, so the markup should be correct.

Not getting mail posted to Channel

Hey,

I'm having the following problem:
I set up mattermail, but I'm not getting anything posted in the channel I configured and I added the user into. Here is my config file:
[ { "Name": "Info", "Server": "$server", "Team": "c3sidechannel", "Channel": "mail", "MattermostUser":"[email protected]", "MattermostPass":"password", "ImapServer": "mail.philmacfly.eu:143", "Email": "[email protected]", "EmailPass": "password", "MailTemplate": ":incoming_envelope: _From: **%v**_\n>_%v_\n\n%v", "StartTLS": true, "Disabled": false, "Debug": true } ]

IMAP StartTLS - unclear error message

I can only connect to IMAP Server with StartTLS when setting "TLSAcceptAllCerts": false

Error message is

INFO Mattermail	09:37:16 Using Mattermost Api Version 3
DEBG Mattermail	09:37:16 Debug mode on
INFO Mattermail	09:37:16 Checking new emails
DEBG Mattermail	09:37:16 MailProviderImap.CheckNewMessage
DEBG Mattermail	09:37:16 MailProviderImap.CheckConnection: Dial
DEBG Mattermail	09:37:16 MailProviderImap.CheckConnection:StartTLS
DEBG Mattermail	09:37:16 s0WLmA STARTTLS

EROR Mattermail	09:37:16 MatterMail.InitMatterMail Error on check new messsage: checkConnection with imap server: enable StartTLS: tls: either ServerName or InsecureSkipVerify must be specified in the tls.Config
DEBG Mattermail	09:37:16 check new message: checkConnection with imap server: enable StartTLS: tls: either ServerName or InsecureSkipVerify must be specified in the tls.Config
INFO Mattermail	09:37:16 Try again in 30s

Does this error message mean that mattermail cannot verifiy the server certificate?

The server is a public Server (mail.your-server.de, hosted by Hetzner in Germany) and has a valid certificate, openssl s_client -connect mail.your-server.de:143 -starttls imap works.

Version is Version: 4.0-dev, with same account mattermail was working fine (I think is was a 3.0-dev) before.

Andreas

Close reason: protocol error against zimbra imap and another imap server

I just replaced the IP addresses with < ...IP > entries in the reported logs

Against one imap:

DEBG Windows News 12:01:07 CheckNewMails
DEBG Windows News 12:01:07 CheckImapConnection: DialTLS
IMAP Windows News 12:01:07 Connected to :993 (Tag=KVJGB)
IMAP Windows News 12:01:11 S: (read tcp :34130->:993: read: connection reset by peer)
IMAP Windows News 12:01:11 Close reason: protocol error
IMAP Windows News 12:01:11 Connection closing (flush=false)
IMAP Windows News 12:01:11 Close error: write tcp :34130->:993: write: broken pipe
IMAP Windows News 12:01:11 Greeting error: read tcp :34130->:993: read: connection reset by peer
EROR Windows News 12:01:11 Unable to connect: read tcp :34130->:993: read: connection reset by peer
INFO Windows News 12:01:11 Waiting new messages
DEBG Windows News 12:01:11 IdleMailBox
DEBG Windows News 12:01:11 CheckImapConnection: DialTLS
IMAP Windows News 12:01:12 Connected to :993 (Tag=ZHTER)
IMAP Windows News 12:01:16 S: (read tcp :34132->:993: read: connection reset by peer)
IMAP Windows News 12:01:16 Close reason: protocol error
IMAP Windows News 12:01:16 Connection closing (flush=false)
IMAP Windows News 12:01:16 Close error: write tcp :34132->:993: write: broken pipe
IMAP Windows News 12:01:16 Greeting error: read tcp :34132->:993: read: connection reset by peer
EROR Windows News 12:01:16 Unable to connect: read tcp :34132->:993: read: connection reset by peer
INFO Windows News 12:01:16 Error Idle: read tcp :34132->:993: read: connection reset by peer

Against Zimbra imap:
IMAP Windows News 15:39:53 Connected to :993 (Tag=XVRDY)

Cannot post to channel

Hi,

whatever I do, it results in:

We couldn't find an existing account matching your credentials. This team may require an invite from the team owner to join.

My config is simple:

[
        {
                "Name":          "Letstest",
                "Server":        "https://mattermost.example.com",
                "Team":          "letstest",
                "Channel":       "rainertest",
                "MattermostUser":"rainer",
                "MattermostPass":"redacted",
                "ImapServer":    "mail.eample.com:993",
                "Email":         "[email protected]",
                "EmailPass":     "redacted",
                "MailTemplate":  ":incoming_envelope: _From: **%v**_\n>_%v_\n\n%v"
        }
]

The URL for this channel is https://mattermost.example.com/letstest/channels/rainertest Do I have to put a #in front of the Channel name? (it does not work either)
raineris a member of this channel and can post from the web UI.
The installation is an omnibus bundled gitlab+mattermost, mattermost uses gitlab as OAuth provider

Error on check new email: AppErrorFromJson: model.utils.decode_json.app_error, invalid character '<' looking for beginning of value

I'm getting this when Mattermail is connecting to a Dovecot IMAP server, and it doesn't retrieve the email. Swotching on debug doesn't give any additional insight:

IMAP ServerMail 10:17:46 S: * 7 EXISTS
IMAP ServerMail 10:17:46 C: DONE
IMAP ServerMail 10:17:46 S: * 1 RECENT
IMAP ServerMail 10:17:46 S: BJDAY5 OK Idle completed.
DEBG ServerMail 10:17:46 CheckNewMails
DEBG ServerMail 10:17:46 CheckImapConnection: Connection alive
IMAP ServerMail 10:17:46 C: BJDAY6 SELECT "INBOX"
IMAP ServerMail 10:17:46 S: * OK [CLOSED] Previous mailbox closed.
IMAP ServerMail 10:17:46 S: * FLAGS (\Answered \Flagged \Deleted \Seen \Draft)
IMAP ServerMail 10:17:46 S: * OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Seen \Draft *)] Flags permitted.
IMAP ServerMail 10:17:46 S: * 7 EXISTS
IMAP ServerMail 10:17:46 S: * 0 RECENT
IMAP ServerMail 10:17:46 S: * OK [UNSEEN 7] First unseen.
IMAP ServerMail 10:17:46 S: * OK [UIDVALIDITY 1463095509] UIDs valid
IMAP ServerMail 10:17:46 S: * OK [UIDNEXT 8] Predicted next UID
IMAP ServerMail 10:17:46 S: * OK [HIGHESTMODSEQ 1] Highest
IMAP ServerMail 10:17:46 S: BJDAY6 OK [READ-WRITE] Select completed.
IMAP ServerMail 10:17:46 C: BJDAY7 UID SEARCH CHARSET UTF-8 UNSEEN
IMAP ServerMail 10:17:46 S: * SEARCH 7
IMAP ServerMail 10:17:46 S: BJDAY7 OK Search completed (0.000 secs).
DEBG ServerMail 10:17:46 CheckNewMails:AddNum 7
IMAP ServerMail 10:17:46 C: BJDAY8 UID FETCH 7 (BODY[])
DEBG ServerMail 10:17:46 CheckNewMails: cmd in Progress
IMAP ServerMail 10:17:46 S: * 7 FETCH (UID 7 FLAGS (\Seen) BODY[] {7559}
IMAP ServerMail 10:17:46 S: literal 7559 bytes
IMAP ServerMail 10:17:46 S: )
DEBG ServerMail 10:17:46 CheckNewMails:PostMail
INFO ServerMail 10:17:46 Error on check new email: AppErrorFromJson: model.utils.decode_json.app_error, invalid character '<' looking for beginning of value

Outlook365 and IDLE error

Hi,

I'm plagued by this error (usually it takes 2-4 weeks of run time to get to the point):
INFO Support 17:17:23 Connected with "imap-mail.outlook.com:993" INFO Support 17:17:33 Error on check new email: imap: command not allowed in the current state Try again in 30s INFO Support 17:18:03 Error Idle: imap: not available (IDLE) Try again in 30s

And it then repeats errors up until I stop it. Since the error start popping up in log no new e-mails are fetched from the inbox.

Any ideas why it is happening?

Feature: Supply configuration file via cmd argument

It's a bit tricky to get mattermail to start automatically as a service with systemd since the relative path ./config.json seems to be hardcoded into mattermail.

It would be nice to be able to supply an alternative configuration file path from the command line.

Problem with certificates

Hello,
I have a problem, all looks good that works, but in my log channel I can see an error:
Error on check new email: /users/login: , Post https://mydomain.com/api/v1/users/login: x509: certificate is valid for *.mydomain.com, not mydomain.com
All should works good and certifacate is for mydomain.com so I dont know why this doesnt work.
Also a link to download for version 3+ doesn`t work, you should make it available again :)
From this three links:

mattermost user check error

hello rodcorsi
i have a problem with using mattermail on mattermost 4.2.0,it seems mattermost user check error,it can't find user in mattermost team,the user can actually login.

email check seems ok.

config like :
[
{
"Name": "Orders",
"Server": "https://xxxx",
"Team": "jzxm",
"Channel": "@liangxm",
"MattermostUser": "liangxm",
"MattermostPass": "sxxxx",
"ImapServer": "imap.exmail.qq.com:993",
"Email": "[email protected]",
"EmailPass": "dxVxx",
"MailTemplate": ":incoming_envelope: From: %v\n>%v\n\n%v",
"StartTLS": false,
"Disabled": false,
"Debug": true,
"LinesToPreview": 10,
"NoRedirectChannel": false,
"NoAttachment": false,
"Filter": [{"Subject":"Zabbix", "Channel":"@liangxm"}]
}
]

error log like :
DEBG Orders 16:44:12 &{https://xxxx https://xxx/api/v3 0xc4203b5320 }
DEBG Orders 16:44:12 Login user:liangxm team:jzxm url:https://xxx
INFO Orders 16:44:12 Error on check new email: : 我们无法在这个团队中找到一个匹配您帐号的用户。此团队或许需要从团队拥有者获得邀请才可加入。

thank you
best wish

Handling of original email content

Rodrigo,
This is a info request rather than a problem report. I was wondering how is handling for the original email content when someone replies to an email. Does the mattermail automatically strip off this content? (I have not yet tried using mattermail, just getting the mailbox ready for my test)

-Renjith

Assign channel from text in subject or body

Would it be possible to assign direct message/channel using text from subject or body e.g:

Any message with subject line= "[bugs] this is a bug" would be assigned to bugs channel or subject line = "[user1] alert for user1 " would send direct message to user1?

Thank you for plugin.

Running Mattermail as a procmail filter

Hi,

Do you think it is possible to evolve mattermail in a way that we can run it as a procmail filter?
Doing this way, no need to run the soft permanently, it is just run when a email arrives in the expected account.

Feature request: option to leave out attachments

Each emailed chat message always seems to get the email.html attachment, even if the email is "empty" (containing tiny html stub, possibly added by service like gmail, but no actual contents).

Please consider option where the whole email body/attachments can just be discarded, so that whole chat message might consist e.g. of just the subject.

Problem to post to some channels

Hi @rodrigocorsi2 ,

first of all: Thanks for this integration!

I´m having trouble posting to some channels, it´s a bit weird:
Channel 'testing': ok
Channel ' Town Square': INFO Mailgateway 21:15:06 Error on check new email: Did not find channel with name Town Square
Channel 'P1': same as Town Square.

The configured user has joined all channels, so that should be no problem.

As if it doesn´t like upper case letters...

Thanks,
Markus

SMTP server support?

Is it possible to define an smtp server for receiving new messages? Currently i get an error when using a non imap server.

unsupported protocol scheme

I'm getting the following error after setting up mattermail:

IMAP Analyzer Notification      09:55:51 S: * 1 RECENT
IMAP Analyzer Notification      09:55:51 S: RCODY5 OK Idle completed.
DEBG Analyzer Notification      09:55:51 CheckNewMails
DEBG Analyzer Notification      09:55:51 CheckImapConnection: Connection alive
IMAP Analyzer Notification      09:55:51 C: RCODY6 SELECT "INBOX"
IMAP Analyzer Notification      09:55:51 S: * OK [CLOSED] Previous mailbox closed.
IMAP Analyzer Notification      09:55:51 S: * FLAGS (\Answered \Flagged \Deleted \Seen \Draft)
IMAP Analyzer Notification      09:55:51 S: * OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Seen \Draft \*)] Flags permitted.
IMAP Analyzer Notification      09:55:51 S: * 7 EXISTS
IMAP Analyzer Notification      09:55:51 S: * 0 RECENT
IMAP Analyzer Notification      09:55:51 S: * OK [UNSEEN 7] First unseen.
IMAP Analyzer Notification      09:55:51 S: * OK [UIDVALIDITY 1482180525] UIDs valid
IMAP Analyzer Notification      09:55:51 S: * OK [UIDNEXT 8] Predicted next UID
IMAP Analyzer Notification      09:55:51 S: RCODY6 OK [READ-WRITE] Select completed (0.000 secs).
IMAP Analyzer Notification      09:55:51 C: RCODY7 UID SEARCH CHARSET UTF-8 UNSEEN
IMAP Analyzer Notification      09:55:51 S: * SEARCH 7
IMAP Analyzer Notification      09:55:51 S: RCODY7 OK Search completed (0.000 secs).
DEBG Analyzer Notification      09:55:51 CheckNewMails:AddNum  7
IMAP Analyzer Notification      09:55:51 C: RCODY8 UID FETCH 7 (BODY[])
DEBG Analyzer Notification      09:55:51 CheckNewMails: cmd in Progress
IMAP Analyzer Notification      09:55:51 S: * 7 FETCH (UID 7 FLAGS (\Seen) BODY[] {787}
IMAP Analyzer Notification      09:55:51 S: literal 787 bytes
IMAP Analyzer Notification      09:55:51 S: )
DEBG Analyzer Notification      09:55:51 CheckNewMails:PostMail
DEBG Analyzer Notification      09:55:51 &{vesuvius.***.com vesuvius.***.com/api/v3 0xc4201f0180      }
DEBG Analyzer Notification      09:55:51 Login user:mattermail@vesuvius.***.com team:*** url:vesuvius.***.com
INFO Analyzer Notification      09:55:51 Error on check new email: /users/login: model.client.connecting.app_error, Post vesuvius.***.com/api/v3/users/login: unsupported protocol scheme ""
 Try again in 30s

support for webhooks

would it be possible to add icomming webhook support? With gitlab as oauth provider, i do not have the possibility to create a MattermostUser/MattermostPassword

Error on check new email: : Invalid message

It is not possible to fetch longer emails. I want to display the whole email. I've sent a testemail with just one line: everything is finde

If I send a testemail with a little bit more lines:

DEBG Emails 11:01:05 CheckNewMails: cmd in Progress
IMAP Emails 11:01:05 S: * 5 FETCH (UID 13 FLAGS (\Seen) BODY[] {8643}
IMAP Emails 11:01:05 S: literal 83 bytes
IMAP Emails 11:01:05 S: literal 258 bytes
IMAP Emails 11:01:05 S: literal 514 bytes
IMAP Emails 11:01:06 S: literal 1179 bytes
IMAP Emails 11:01:06 S: literal 1179 bytes
IMAP Emails 11:01:06 S: literal 1179 bytes
IMAP Emails 11:01:06 S: literal 559 bytes
IMAP Emails 11:01:06 S: literal 1179 bytes
IMAP Emails 11:01:06 S: literal 1179 bytes
IMAP Emails 11:01:06 S: literal 720 bytes
IMAP Emails 11:01:06 S: literal 614 bytes
IMAP Emails 11:01:06 S: )
DEBG Emails 11:01:06 CheckNewMails:PostMail
DEBG Emails 11:01:06 &{ MATTERMOSTLINK }
DEBG Emails 11:01:06 Login user:MATTERMOSTUSER team:MATTERMOSTTEAM url:MATTERMOSTURL
INFO Emails 11:01:06 Post new message
DEBG Emails 11:01:06 Try to find channel/user by subject
DEBG Emails 11:01:06 Did not find channel/user from Email Subject. Look for filter
DEBG Emails 11:01:06 Did not find channel/user in filters. Look for channel 'MATTERMOSTCHANNEL'
DEBG Emails 11:01:06 Post email in MATTERMOSTCHANNEL
INFO Emails 11:01:06 Error on check new email: : Invalid message,
Try again in 30s

I'm trying the option

"LinesToPreview": 100

Pulling email only from a specific folder(s)

If mattermail could be configured to pull email only from a specific folder(s) it could save having to set up a different email account for each different thing. This way can use already existing server side filtering software (like sieve or procmail) to filter the mail into the correct folder(s) without having to worry about writing our own filtering code in mattermail.

Build error - log4go submodule

I'm trying to dockerize this nice service, but there is something fishy going on.

I encounter the following issue when building mattermail:

  • using go1.7.4 darwin/amd64 on OS X
  • inside a alpine-golang:1.7.3 Docker container - here is the Dockerfile
➜  go get github.com/rodrigocorsi2/mattermail
# cd /Users/banzo/mattermail/src/github.com/rodrigocorsi2/mattermail; git submodule update --init --recursive
No submodule mapping found in .gitmodules for path 'vendor/github.com/alecthomas/log4go'
package github.com/rodrigocorsi2/mattermail: exit status 1

Note that cloning the repo using Sourcetree triggers a very similar error:

git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree clone https://github.com/banzo/mattermail.git /Users/banzo/mattermail 
Cloning into '/Users/banzo/mattermail'...
warning: templates not found /usr/local/git/share/git-core/templates

git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree submodule update --init --recursive 
No submodule mapping found in .gitmodules for path 'vendor/github.com/alecthomas/log4go'
Completed with errors, see above

Create a way to post in teams with OAuth/Ldap

Today there is no way to post in teams with ldap or oAuth.
One alternative is using webhook, but this is very limited because of filter rules and redirect by the subject.
Other way is create login alternatives by ldap and oAuth

Panic error when receiving mails

I had a working configuration on ubuntu 14.04 x64. Had to move it (just copied folder) to a 12.04 x64, since then i get following errors when receiving mails:

INFO Exceptions 14:05:42 Waiting new messages
INFO Exceptions 14:14:45 Post new message
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x491cc6]

goroutine 6 [running]:
panic(0x80f220, 0xc42000a070)
        G:/Go/src/runtime/panic.go:500 +0x1a1
github.com/rodrigocorsi2/mattermail/mmail.getChannelIDByName(0x0, 0xc4201572e9, 0x5, 0x1, 0x1)
        G:/GoPath/src/github.com/rodrigocorsi2/mattermail/mmail/mattermail.go:383 +0x26
github.com/rodrigocorsi2/mattermail/mmail.(*MatterMail).getChannelID(0xc420188000, 0xc42026f2c0, 0x0, 0xc4201572e8, 0x6, 0xc4201572e8, 0x6)
        G:/GoPath/src/github.com/rodrigocorsi2/mattermail/mmail/mattermail.go:375 +0x7d
github.com/rodrigocorsi2/mattermail/mmail.(*MatterMail).PostFile(0xc420188000, 0xc420263fe0, 0x11, 0xc42026f080, 0x53, 0xc42027a500, 0x124, 0x0, 0x0, 0xc4201a3950, ...)
        G:/GoPath/src/github.com/rodrigocorsi2/mattermail/mmail/mattermail.go:294 +0x12a1
github.com/rodrigocorsi2/mattermail/mmail.(*MatterMail).PostMail(0xc420188000, 0xc420263f20, 0x1, 0x1)
        G:/GoPath/src/github.com/rodrigocorsi2/mattermail/mmail/mattermail.go:580 +0x557
github.com/rodrigocorsi2/mattermail/mmail.(*MatterMail).CheckNewMails(0xc420188000, 0x0, 0x0)
        G:/GoPath/src/github.com/rodrigocorsi2/mattermail/mmail/mattermail.go:164 +0x88a
github.com/rodrigocorsi2/mattermail/mmail.(*MatterMail).CheckNewMails-fm(0x0, 0x0)
        G:/GoPath/src/github.com/rodrigocorsi2/mattermail/mmail/mattermail.go:609 +0x2a
github.com/rodrigocorsi2/mattermail/mmail.(*MatterMail).tryTime(0xc420188000, 0x8859a2, 0x19, 0xc4201a3ed8)
        G:/GoPath/src/github.com/rodrigocorsi2/mattermail/mmail/mattermail.go:36 +0x3c
github.com/rodrigocorsi2/mattermail/mmail.InitMatterMail(0xc420154c30)
        G:/GoPath/src/github.com/rodrigocorsi2/mattermail/mmail/mattermail.go:614 +0x852
main.main.func1(0xc420154c30, 0xc420157360)
        G:/GoPath/src/github.com/rodrigocorsi2/mattermail/main.go:99 +0x2b
created by main.main
        G:/GoPath/src/github.com/rodrigocorsi2/mattermail/main.go:101 +0x1fd

my config for exceptions looks like that:

    {
  "Name":              "Exceptions",
  "Server":            "http://192.168.97.206:8065",
  "Team":              "team",
  "Channel":           "#tickets",
  "MattermostUser":    "[email protected]",
  "MattermostPass":    "xxxx",
  "ImapServer":        "mail.xxx.com:143",
  "Email":             "[email protected]",
  "EmailPass":         "xxxx",
  "MailTemplate":      ":incoming_envelope: _From: **%v**_\n>_%v_\n\n%v",
  "StartTLS":          false,
  "Disabled":          false,
  "Debug":             false,
  "LinesToPreview":    20,
  "NoRedirectChannel": false,
  "Filter":             [
    {"From":"[email protected]", "Channel":"#exceptions"},
    {"From":"[email protected]", "Channel":"#monit"}
  ]
}

Any ideas whats wrong?

Mattermost 3.5 is active

Mattermost moving to API version 4

Hey @rodrigocorsi2 !

First, hugely appreciate you sharing this project back with the world. Fantastic work!

I wanted to let you know about our plans moving to API v4:

To make the Mattermost API web service easier to use and to offer more powerful options for these integrations, Mattermost will be moving to a new API version soon. Highlights include:

  • Fully documented API endpoints
  • More in-depth access to server functionality
  • Wider use of established HTTP verbs
  • Consistent endpoint structures
  • A new and improved Go driver

We plan to release API version 4 on March 16th, with Mattermost server 3.7. While the current API version 3 will be supported until September 16th, we recommend you begin using API version 4 soon after its release.

Contributing

API version 4 is an active and on-going project. If you're interested in helping contribute, please join our Mattermost community instance and the APIv4 channel.

We've prepared a contribution process for APIv4 and a progress tracker for new APIv4 enpoints to help you get started.

We're also open for suggestions on adding new API endpoints to help with your integration.

us-ascii charset not working

The error message is:

2017/01/18 19:15:22 Loading  ./config.json
2017/01/18 19:15:22 MatterMail version: 3.5.0
INFO Mattermail	19:15:22 Checking new emails
INFO Mattermail	19:15:23 Connected with "XXXX.com:993"
EROR Mattermail	19:15:23 UID SEARCH US-ASCII
INFO Mattermail	19:15:23 Error on check new email: imap: unexpected completion status ("GAWVC6 BAD Invalid charset specified")
 Try again in 30s

This is what the mail header says:
Content-Type: text/plain; charset=us-ascii

Can't build mattermail: "src/github.com/rodrigocorsi2/mattermail/mattermail.go:308: client.UploadFile undefined (type *model.Client has no field or method UploadFile, but does have model.uploadFile)"

Hello.
I want to build your project in docker image. So in base image alpine i install go, git and build projects (also define GOPATH):
$ GOPATH=/home/mmail go get github.com/jhillyerd/go.enmime
$ GOPATH=/home/mmail go get github.com/mattermost/platform/model
$ GOPATH=/home/mmail go get github.com/mxk/go-imap/imap
$ GOPATH=/home/mmail go get github.com/paulrosania/go-charset/charset
$ GOPATH=/home/mmail go get github.com/paulrosania/go-charset/data

But, when i build mattermail i got the error:
$ GOPATH=/home/mmail go get github.com/rodrigocorsi2/mattermail

github.com/rodrigocorsi2/mattermail

src/github.com/rodrigocorsi2/mattermail/mattermail.go:308: client.UploadFile undefined (type *model.Client has no field or method UploadFile, but does have model.uploadFile)

Old binaries in release packages

The *linux.am64.tar.gz versions of 3.0.6 and 3.0.11 version packages seem to contain pre-built binary of 3.0.3 rather than binary matching the actual version.

Possible issue with team names containing spaces

Hi,

mattermail does log in successfully with username and password but has trouble to choose the correct team name. The code bails out differently when the password is wrong.

I suspect it is because the team name is "Familie Berger", i.e. having a space in between

2017/01/19 00:28:23 Loading mattermail.json
2017/01/19 00:28:23 MatterMail version: 3.5.0
.....
.....
DEBG Mattermail 00:28:23 Debug mode on
DEBG Mattermail 00:19:17 CheckNewMails:PostMail
DEBG Mattermail 00:19:17 &{https://mm.familie-berger.net https://mm.familie-berger.net/api/v3 0xc4201b3c80 }`
DEBG Mattermail 00:19:17 Login user:[email protected] team:Familie Berger url:https://mm.familie-berger.net
INFO Mattermail 00:19:17 Post new message
INFO Mattermail 00:19:17 Error on check new email: Did not find team with name Familie Berger
Try again in 30s

DEBG Mattermail 00:19:47 CheckNewMails
DEBG Mattermail 00:19:47 CheckImapConnection: Connection alive
IMAP Mattermail 00:19:47 C: PXKYT10 UID SEARCH CHARSET UTF-8 UNSEEN
IMAP Mattermail 00:19:47 S: * 4 FETCH (FLAGS (\Seen))
IMAP Mattermail 00:19:47 S: PXKYT9 OK FETCH completed.
IMAP Mattermail 00:19:47 S: * SEARCH
IMAP Mattermail 00:19:47 S: PXKYT10 OK SEARCH done.
DEBG Mattermail 00:19:47 CheckNewMails: No new messages
DEBG Mattermail 00:19:47 IdleMailBox
DEBG Mattermail 00:19:47 CheckImapConnection: Connection alive

Error on check new email: imap: unexpected completion status (EXCHANGE 2010)

We using Exchange 2010 with imap

[root@XXXXX appl]# ./mattermail
INFO  Email     14:08:22 Checking new emails
INFO  Email     14:08:22 Connected with "owa.XXX.XXX:143"
ERROR Email     14:08:22 UIDSearch:
INFO  Email     14:08:22 Error on check new email: imap: unexpected completion status ("ZOXKQ5 NO [BADCHARSET (US-ASCII)] The specified charset is not supported.")
 Try again in 30s
^C[root@XXXXXXappl]# ./mattermail > /opt/appl/mattermail.log
ERROR Email     14:08:31 UIDSearch:
rror on check new email: imap: unexpected completion status ("ZOXKQ5 NO [BADCHARSET (US-ASCII)] The specified charset is not supportedERROR Email       14:09:01 UIDSearch:

CONFIG:

[
        {
                "Name":          "Email",
                "Server":        "http://XXXX.XXXX.XXX",
                "Team":          "XX-XX",
                "ChannelId":     "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
                "MattermostUser":"[email protected]",
                "MattermostPass":"XXXXXXXX",
                "ImapServer":    "owa.XXXXX.XXX:143",
                "Email":         "[email protected]",
                "EmailPass":     "XXXXXXXX",
                "MailTemplate":  ">:incoming_envelope: _From:_ **%v**\n_%v_\n\n$
                "Debug":        true
        }


]

It looks like i also diddnt get the Debug mode running.
./mattermail > /opt/appl/mattermail.log 2>&1 &

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.