Project

General

Profile

Receiving emails from Office365

Added by cyril Thibout over 7 years ago

Hi

Many customers complain about Redmine because they wish they could answer or post an issue from their email client.

This is what RedmineReceivingEmails is about but how can we setup this connection with an office365 email server ?

Since we can't access the server itself the first solution "Forwarding emails from your email server" has to be droped

The second solution 'Fetching emails from an IMAP server' doesn't work either since Office365 is not an IMAP server

so what should be done with Office365 + Redmine please ?

thanks

Cyril


Replies (19)

RE: Receiving emails from Office365 - Added by Pierre Maigne over 7 years ago

Hi,

I am sending (SMTP) and receiving (POP) emails with Office 365.

I created an account with a kiosk license (K1) in office 365..

For sending emails, just check the configuration in the Wiki which is correct for O365 (http://www.redmine.org/projects/redmine/wiki/EmailConfiguration#Office-365-Exchange-Online)

For receiving, I use this plugin for easier trigger of the email receiving :
https://github.com/jbox-web/redmine_mail_checker
Follow the instructions on the plugin page, and I attached a screenshot of my configuration for O365.

Good luck

RE: Receiving emails from Office365 - Added by cyril Thibout over 7 years ago

Thanks

Will all the emails sent to this o365 address be used in the redmine ? How will redmine know that this email is a real redmine email or a spam ?

thanks

cyril

RE: Receiving emails from Office365 - Added by Pierre Maigne over 7 years ago

Redmine matches the sender email address with the user email in Redmine, and then uses the email object to associate the email with the relevant issue (when updating an existing issue). I don't know for new issues as we don't have this case.

RE: Receiving emails from Office365 - Added by cyril Thibout over 7 years ago

ok Pierre, thanks

and should I set up a cron task somewhere to activate the collect of incoming messages please ?

thanks

Cyril

RE: Receiving emails from Office365 - Added by Pierre Maigne over 7 years ago

Yes, I created a task in the Windows Task Scheduler (see Screenshot attached), which runs every 5 minutes during business hours, every 15 minutes at night.

I downloaded curl from https://curl.haxx.se/download.html

RE: Receiving emails from Office365 - Added by cyril Thibout over 7 years ago

Hi

Ok thanks!

In the /settings?tab=mail_handler page I generated a new key

However I get an error:

the redmine log says:

Started GET "/check_mails?key=3TVn1Hbw2wTnDzZpLPXN" for 192.168.16.250 at 2017-07-24 18:12:33 +0200
Processing by MailCheckerController#index as HTML
Parameters: {"key"=>"3TVn1Hbw2wTnDzZpLPXN"}
Current user: anonymous
Completed 500 Internal Server Error in 5ms (ActiveRecord: 0.4ms)

NoMethodError (undefined method `upcase' for nil:NilClass):
plugins/redmine_mail_checker/app/controllers/mail_checker_controller.rb:19:in `index'
lib/redmine/sudo_mode.rb:63:in `sudo_mode'

Any idea please ?

thanks

cyril

RE: Receiving emails from Office365 - Added by Pierre Maigne over 7 years ago

Unfortunately, I am not a developer, and as far as I remember, I never had this error before. My current Redmine version is 3.4 and the plugin should work since version 2.4
Mail checker has also is own log besides redmine one you could maybe check.

RE: Receiving emails from Office365 - Added by Pierre Maigne over 7 years ago

Have you correctly setup the plugin options ?

I guess if you remove the ".upcase" on line 19 in app/controllers/mail_checker_controller.rb, it should fix your issue without damage.

RE: Receiving emails from Office365 - Added by cyril Thibout over 7 years ago

I guess I have following your example

In the app/controllers/mail_checker_controller.rb I also changed the line :

RedmineMailChecker.logger.info("Checking #{protocol.upcase} mails")

into

RedmineMailChecker.logger.info("Checking  mails")

Now when I run the /check_mails?key=3TVn1Hbw2wTnDzZpLPXN page the log says:

Completed 200 OK in 24ms (Views: 0.4ms | ActiveRecord: 19.6ms)
Started GET "/check_mails?key=3TVn1Hbw2wTnDzZpLPXN" for 192.168.16.250 at 2017-07-24 18:42:19 +0200
Processing by MailCheckerController#index as HTML
Parameters: {"key"=>"3TVn1Hbw2wTnDzZpLPXN"}
Current user: cyril (id=11)
Rendered text template (0.0ms)
Completed 200 OK in 33ms (Views: 0.4ms | ActiveRecord: 28.3ms)

but I get no new entries in the forum while I answered one of the emails notifications directly to test

Cyril

RE: Receiving emails from Office365 - Added by cyril Thibout over 7 years ago

Hi

I think I saw what causes the problem:

Whatever parameters I write in the /settings/plugin/redmine_mail_checker page when I save the page with the APPLY button I get a good messsage "sucess" but nothing is saved.

should we do something so that the settings are saved please ?

thanks

cyril

RE: Receiving emails from Office365 - Added by Pierre Maigne over 7 years ago

Yes, there is a problem. I tried to change 1 parameter in the plugin configuration and I lost the configuration completely... I can't receive email anymore :(

RE: Receiving emails from Office365 - Added by cyril Thibout over 7 years ago

Ok, that's confirmed at least.

Where should the settings be saved ? in a file (which one?) or in the database (where ?)

thanks

cyril

RE: Receiving emails from Office365 - Added by Pierre Maigne over 7 years ago

Ok, I fixed the issue and created a pull request. Until the fix is merged, you can use my fork https://github.com/Atmis/redmine_mail_checker

Settings were properly saved in the DB, but the syntax to retrieve the settings has changed.

It is now working again for me.

Bon courage

Pierre

RE: Receiving emails from Office365 - Added by cyril Thibout over 7 years ago

Hi

I downloaded the new files but it didn't change anything. I checked the 5 files you changed. They all have now the right syntax: RedmineMailChecker.get_setting('xxx') though

should I say I'm on the following environment ?

Redmine version                3.3.0.devel
Ruby version 2.3.0-p0 (2015-12-25) [x86_64-linux]
Rails version 4.2.7.1
Environment production
Database adapter Mysql2

Cyril

RE: Receiving emails from Office365 - Added by cyril Thibout over 7 years ago

Ok, it's working now, I don't know why it didnt' work a few hours before (cache ?) but now users can reply to issues and forum threads directly via emails.

thanks a lot !

cyril

RE: Receiving emails from Office365 - Added by Pierre Maigne over 7 years ago

Glad it worked !

Pierre

RE: Receiving emails from Office365 - Added by Pierre Maigne over 7 years ago

To be exhaustive, and for future references, I am sharing here my truncation config for incoming emails, using regular expressions. It is standard if you use redmine 3.4+ (just check "use regular expressions" option) or you can use that plugin for older redmine versions (up to 3.3): http://www.redmine.org/plugins/redmine_mail_handler_clean_body_regexp

These filters have been tested with Outlook, OWA, Gmail, Outlook Mobile, Mail on iOS and other mail clients. French and English. Just change the domain and xxxxx according to your configuration.

[*]*De.*:[*] Redmine xxxxxxxx.*
[*]*De.*:[*] redmine@domain.tld.*
De.*: Redmine xxxxxxxx.*
De.*: redmine@domain.tld.*
De :[\r\n]Redmine xxxxxxxx.*
De :[\r\n]redmine@domain.tld.*
From.*: Redmine xxxxxxxx.*
From.*: redmine@domain.tld.*
From :[\r\n]Redmine xxxxxxxx.*
From :[\r\n]redmine@domain.tld.*
Le.*crit.*:.*
On.*wrote.*:.*
\d\d\d\d-\d\d-\d\d.\d\d:\d\d.*
redmine@domain.tld a .crit :.*
Date:(.*)\+\d\d\d\d
_____________________________.*
La demande #\d* a .t.(.*)[.].*
Issue #\d* has been(.*)[.].*

RE: Receiving emails from Office365 - Added by jaswanth kamadana about 7 years ago

Hi pierre,

I am facing the same problem from last one week. I done all the steps whatever you explained in this page. But still i am unable to receive the mails to office365 mail id. Can you please suggest me where i am missing.

installation info is:

Environment:
  Redmine version                3.2.3.stable
  Ruby version                   2.3.1-p112 (2016-04-26) [x86_64-linux-gnu]
  Rails version                  4.2.7.1
  Environment                    production
  Database adapter               Mysql2
SCM:
  Git                            2.9.3
  Filesystem                     
Redmine plugins:
  redmine_mail_checker           1.0.0
and the configuration.yml info is
production:
  email_delivery:
    delivery_method: :async_smtp
  async_smtp_settings:
      enable_starttls_auto: true
      address: "smtp.office365.com" 
      port: '587'
      domain: "domain.com" 
      authentication: :login
      user_name: "sample@domain.com" 
      password: "xxxx" 

Thanks & Regards
Jaswanth

RE: Receiving emails from Office365 - Added by cyril Thibout about 7 years ago

Hi

why the fix on https://github.com/Atmis/redmine_mail_checker hasn't been merged ?

and would it be possible that the automatically created issue from the incoming email would only take the ANSWER and not the whole email?

Generally people just reply to the notification and it creates a very long issue with 80% of it being the copy of the previous entry.

thanks

cyril

    (1-19/19)