taqueci / redmine_mail_from

Redmine plugin for adding user name and/or mail address to the "From:" header field of the notification mail.
GNU General Public License v2.0
13 stars 3 forks source link

Error when updating / creating user #2

Open cukal opened 7 years ago

cukal commented 7 years ago

When creating or updating a user I get this error:

NoMethodError (undefined method firstname' for nil:NilClass): plugins/redmine_mail_from/lib/redmine_mail_from/mailer_model_patch.rb:18:inmail_with_patch' app/models/mailer.rb:271:in account_information' app/models/mailer.rb:494:ininitialize' config/initializers/10-patches.rb:163:in deliver' app/controllers/users_controller.rb:98:increate' lib/redmine/sudo_mode.rb:63:in `sudo_mode'

Environment: Redmine version 3.3.2.stable.16215 Ruby version 2.0.0-p648 (2015-12-16) [x86_64-linux] Rails version 4.2.7.1 Environment production Database adapter Mysql2

CentOS7

taqueci commented 7 years ago

Hello, @cukal

Thank you for your reporting issue. I have fixed the bug. Please use the latest one.

juxta73 commented 7 years ago

hello! same error. and after updating i have there error logs:

Rendered mailer/reminder.text.erb within layouts/mailer (0.2ms) Rendered mailer/reminder.html.erb within layouts/mailer (2.2ms) Email delivery error: 501 < via Redmine>: "@" or "." expected after "Redmine"

Settings: %f %l via Redmine <%m>

taqueci commented 7 years ago

Hello, @juxta73

Thank you for your reporting. I'm not sure, but the 501 error may come from your SMTP server.

tofi86 commented 7 years ago

The same error message appears when using the Redmine built in reminder emails:

rake aborted!
NoMethodError: undefined method `firstname' for nil:NilClass
/var/www/projekte/redmine-3.3/plugins/redmine_mail_from/lib/redmine_mail_from/mailer_model_patch.rb:18:in `mail_with_patch'
/var/www/projekte/redmine-3.3/app/models/mailer.rb:110:in `reminder'
/usr/local/rvm/gems/ruby-2.2.1/gems/actionpack-4.2.7.1/lib/abstract_controller/base.rb:198:in `process_action'
...
tofi86 commented 7 years ago

Okay, the latest version of the plugin does not thrwo this error anymore.

But the Redmine reminder emails still fail with:

  Rendered mailer/reminder.text.erb within layouts/mailer (0.8ms)
  Rendered mailer/reminder.html.erb within layouts/mailer (33.2ms)
Email delivery error: 501 Syntax error in parameters or arguments

I used the suggested pattern %f %l via Redmine <%m>

taqueci commented 7 years ago

Hello, @tofi86

Some SMTP servers may reject <%m> because the server expects a fully valid mail address.

In order to find a suitable setting for your environment, please try:

  1. Tobias Fischer <tofi86@yourdomain.com>
  2. %f %l <tofi86@yourdomain.com>
  3. Tobias Fischer <%m>
  4. %f %l <%m>
tofi86 commented 7 years ago

I think the problem here is, that in the context of sending the reminder emails, there is no valid "sender". It's a system action, not a user generated action... so I think it's failing to retrieve user information...

Can you check that?

Am 30.01.2017 um 16:42 schrieb taqueci notifications@github.com:

Hello, @tofi86

Some SMTP servers may reject <%m> because the server expects a fully valid mail address.

In order to find a suitable setting for your environment, please try:

Tobias Fischer tofi86@yourdomain.com %f %l tofi86@yourdomain.com Tobias Fischer <%m> %f %l <%m>

misha-tgshv commented 7 years ago

The same problem with the pattern%f %l via Redmine <%m> - 501 < via Redmine>: "@" or "." expected after "Redmine"

Working:

  1. Tobias Fischer tofi86@yourdomain.com
taqueci commented 7 years ago

The latest version supports the second mail address for the reminder. Please pull and try the pattern e.g. %f %l via Redmine <%m> :: Redmine <no-reply@example.com>.

misha-tgshv commented 7 years ago

Thanks 👍

tofi86 commented 7 years ago

The latest version supports the second mail address for the reminder. Please pull and try the pattern e.g. %f %l via Redmine <%m> :: Redmine no-reply@example.com

For system generated mails it works, but if I make a change from a normal user, the "From" gets displayed empty in Thunderbird.

I tried exactly your pattern.

tofi86 commented 7 years ago

I just see in the mail plaintext view that the From is filled correctly: From: Tobias Fischer via Redmine <tobias.fischer@host.tld>

But it's displayed as empty From in Thunderbird anyway...

Plus: the List-ID field contains the unresolved FROM: List-Id: <%f %l via Redmine <%m> :: Redmine <redmine-no-reply.host.tld>>

I'm sorry, but until this plugin is tested really well, I'm gonna drop this and will not test again...

taqueci commented 7 years ago

Hello @tofi86

Thank you for your information. As you said, List-Id is not correct.

I use not only Thunderbird but also iPhone, GMail/Inbox app and IBM Notes. But I can see From filed correctly...

taqueci commented 7 years ago

Hello @tofi86

The latest version 1.2.0 sets List-Id with better one generated from host name. I hope it works well in your environment.

tofi86 commented 7 years ago

Okay, I'll give it another try...

misha-tgshv commented 7 years ago

Not working

tofi86 commented 7 years ago

a little late, but works well for me.