Redmine-Administration-Notification -- An error occurred while sending mail

Added by Barry Reddy about 11 years ago

I am trying to debug the mail notification error from testing
sending email, on the 'administration/notification redmine page.

I've already verified my setup matches the instructions on the HowTo page
for HowTo configure Redmine to mail to MS Exchange server which is the
type of smarthost I'm using but I'm still getting the error.

An error occurred while sending mail (501 Syntax: HELO hostname )

Checking the /var/log/mail.log also shows

lost connection after HELO from localhost[127.0.0.1]

I have redmine running in a xen debian 4.0 instance with postfix
installed and working (from command line smtp sending) I have
smtpd -v turned on in the /etc/postfix/master.cf to provide debug
output specific to the redmine test mail attempt

@May 7 17:33:21 xen1 postfix/smtpd5565: connect from localhost[127.0.0.1]
May 7 17:33:21 xen1 postfix/smtpd5565: match_list_match: localhost: no match
May 7 17:33:21 xen1 postfix/smtpd5565: match_list_match: 127.0.0.1: no match
May 7 17:33:21 xen1 postfix/smtpd5565: match_list_match: localhost: no match
May 7 17:33:21 xen1 postfix/smtpd5565: match_list_match: 127.0.0.1: no match
May 7 17:33:21 xen1 postfix/smtpd5565: match_hostname: localhost ~? 127.0.0.0/8
May 7 17:33:21 xen1 postfix/smtpd5565: match_hostaddr: 127.0.0.1 ~? 127.0.0.0/8
May 7 17:33:21 xen1 postfix/smtpd5565: > localhost[127.0.0.1]: 220 xen1._domain_.lan ESMTP Postfix (Debian/GNU)
May 7 17:33:21 xen1 postfix/smtpd5565: < localhost[127.0.0.1]: EHLO
May 7 17:33:21 xen1 postfix/smtpd5565: > localhost[127.0.0.1]: 501 Syntax: EHLO hostname
May 7 17:33:21 xen1 postfix/smtpd5565: < localhost[127.0.0.1]: HELO
May 7 17:33:21 xen1 postfix/smtpd5565: > localhost[127.0.0.1]: 501 Syntax: HELO hostname
May 7 17:33:21 xen1 postfix/smtpd5565: smtp_get: EOF
May 7 17:33:21 xen1 postfix/smtpd5565: match_hostname: localhost ~? 127.0.0.0/8
May 7 17:33:21 xen1 postfix/smtpd5565: match_hostaddr: 127.0.0.1 ~? 127.0.0.0/8
May 7 17:33:21 xen1 postfix/smtpd5565: lost connection after HELO from localhost[127.0.0.1]
May 7 17:33:21 xen1 postfix/smtpd5565: disconnect from localhost[127.0.0.1]
May 7 17:33:21 xen1 postfix/smtpd5565: master_notify: status 1
May 7 17:33:21 xen1 postfix/smtpd5565: connection closed

@

I have also commented out the following

#config.action_mailer.logger = nil

from $REDMINE/config/environments/production.rb

The output is as follows
@
Processing AdminController#test_email (for 172.20.5.112 at 2008-05-07 17:37:03) [GET]
Session ID: 6033a416d000b2ffb192f4137bc6fd99
Parameters: {"action"=>"test_email", "controller"=>"admin"}
Redirected to http://redmine._domain_.lan/settings/edit?tab=notifications
Completed in 0.13386 (7 reqs/sec) | DB: 0.00000 (0%) | 302 Found [http://redmine._domain_.lan/admin/test_email]

Processing SettingsController#edit (for 172.20.5.112 at 2008-05-07 17:37:04) [GET]
Session ID: 6033a416d000b2ffb192f4137bc6fd99
Parameters: {"action"=>"edit", "controller"=>"settings", "tab"=>"notifications"}
Rendering template within layouts/base
Rendering settings/edit
Completed in 0.11236 (8 reqs/sec) | Rendering: 0.10870 (96%) | DB: 0.00000 (0%) | 200 OK [http://redmine._domain_.lan/settings/edit?tab=notifications]
@

I'm not sure if anyone can shed any light on getting this working any help would be
appreciated.

Replies (13)

RE: Redmine-Administration-Notification -- An error occurred while sending mail - Added by Thomas R Koll about 11 years ago

Are you sure you have a MS exchange server? It looks more like postfix

For me it was enough to use :sendmail for delivery:
config.action_mailer.delivery_method = :sendmail

RE: Redmine-Administration-Notification -- An error occurred while sending mail - Added by Barry Reddy about 11 years ago

The local box on which redmine is installed is running postfix,
it is using MS exchange as its smarthost.

RE: Redmine-Administration-Notification -- An error occurred while sending mail - Added by Eric Davis about 11 years ago

It looks like the postfix server isn't getting the hostname it requires.

May 7 17:33:21 xen1 postfix/smtpd[5565]: < localhost[127.0.0.1]: EHLO
May 7 17:33:21 xen1 postfix/smtpd[5565]: > localhost[127.0.0.1]: 501 Syntax: EHLO hostname
May 7 17:33:21 xen1 postfix/smtpd[5565]: < localhost[127.0.0.1]: HELO
May 7 17:33:21 xen1 postfix/smtpd[5565]: > localhost[127.0.0.1]: 501 Syntax: HELO hostname

Since you are not connecting to Exchange directly, you should add the :domain into your smtp settings. Once Postfix has it, it should relay it to exchange itself. I'm using this configuration on my server (Xen Debian 4.0 with Postfix).

config.action_mailer.smtp_settings = {
                :address => "127.0.0.1",
                :port => 25,
                :domain => "somenet.foo" 
  }

RE: Redmine-Administration-Notification -- An error occurred while sending mail - Added by Barry Reddy about 11 years ago

This is what is currently in my /opt/redmine/config/environment.rb
for SMTP configuration.

# SMTP server configuration
config.action_mailer.smtp_settings = {
:address => "172.20.5.5",
:port => 25,
:domain => "mydomain.com",

This is what I'm getting in my /var/log/mail.log when attempting
to send mail using redmine->administration->notification->test email

May 7 22:56:32 xen1 postfix/smtpd[5964]: connect from localhost[127.0.0.1]
May 7 22:56:32 xen1 postfix/smtpd[5964]: match_list_match: localhost: no match
May 7 22:56:32 xen1 postfix/smtpd[5964]: match_list_match: 127.0.0.1: no match
May 7 22:56:32 xen1 postfix/smtpd[5964]: match_list_match: localhost: no match
May 7 22:56:32 xen1 postfix/smtpd[5964]: match_list_match: 127.0.0.1: no match
May 7 22:56:32 xen1 postfix/smtpd[5964]: match_hostname: localhost ~? 127.0.0.0/8
May 7 22:56:32 xen1 postfix/smtpd[5964]: match_hostaddr: 127.0.0.1 ~? 127.0.0.0/8
May 7 22:56:32 xen1 postfix/smtpd[5964]: > localhost[127.0.0.1]: 220 xen1.mydomain.lan ESMTP Postfix (Debian/GNU)
May 7 22:56:32 xen1 postfix/smtpd[5964]: < localhost[127.0.0.1]: EHLO
May 7 22:56:32 xen1 postfix/smtpd[5964]: > localhost[127.0.0.1]: 501 Syntax: EHLO hostname
May 7 22:56:32 xen1 postfix/smtpd[5964]: < localhost[127.0.0.1]: HELO
May 7 22:56:32 xen1 postfix/smtpd[5964]: > localhost[127.0.0.1]: 501 Syntax: HELO hostname
May 7 22:56:32 xen1 postfix/smtpd[5964]: smtp_get: EOF
May 7 22:56:32 xen1 postfix/smtpd[5964]: match_hostname: localhost ~? 127.0.0.0/8
May 7 22:56:32 xen1 postfix/smtpd[5964]: match_hostaddr: 127.0.0.1 ~? 127.0.0.0/8
May 7 22:56:32 xen1 postfix/smtpd[5964]: lost connection after HELO from localhost[127.0.0.1]
May 7 22:56:32 xen1 postfix/smtpd[5964]: disconnect from localhost[127.0.0.1]
May 7 22:56:32 xen1 postfix/smtpd[5964]: master_notify: status 1
May 7 22:56:32 xen1 postfix/smtpd[5964]: connection closed

Just to confirm, I can send mail from the command line using
mailx -s "subject" < message.txt

RE: Redmine-Administration-Notification -- An error occurred while sending mail - Added by Barry Reddy about 11 years ago

Sorry that SMTP server configuration should look like this

        # SMTP server configuration
        config.action_mailer.smtp_settings = {
                :address => "127.0.0.1",
                :port => 25,
                :domain => "mydomain.com",

and the /var/log/mail.log output should look like this

May  7 22:56:32 xen1 postfix/smtpd[5964]: connect from localhost[127.0.0.1]
May  7 22:56:32 xen1 postfix/smtpd[5964]: match_list_match: localhost: no match
May  7 22:56:32 xen1 postfix/smtpd[5964]: match_list_match: 127.0.0.1: no match
May  7 22:56:32 xen1 postfix/smtpd[5964]: match_list_match: localhost: no match
May  7 22:56:32 xen1 postfix/smtpd[5964]: match_list_match: 127.0.0.1: no match
May  7 22:56:32 xen1 postfix/smtpd[5964]: match_hostname: localhost ~? 127.0.0.0/8
May  7 22:56:32 xen1 postfix/smtpd[5964]: match_hostaddr: 127.0.0.1 ~? 127.0.0.0/8
May  7 22:56:32 xen1 postfix/smtpd[5964]: > localhost[127.0.0.1]: 220 xen1.mydomain.lan ESMTP Postfix (Debian/GNU)
May  7 22:56:32 xen1 postfix/smtpd[5964]: < localhost[127.0.0.1]: EHLO 
May  7 22:56:32 xen1 postfix/smtpd[5964]: > localhost[127.0.0.1]: 501 Syntax: EHLO hostname
May  7 22:56:32 xen1 postfix/smtpd[5964]: < localhost[127.0.0.1]: HELO 
May  7 22:56:32 xen1 postfix/smtpd[5964]: > localhost[127.0.0.1]: 501 Syntax: HELO hostname
May  7 22:56:32 xen1 postfix/smtpd[5964]: smtp_get: EOF
May  7 22:56:32 xen1 postfix/smtpd[5964]: match_hostname: localhost ~? 127.0.0.0/8
May  7 22:56:32 xen1 postfix/smtpd[5964]: match_hostaddr: 127.0.0.1 ~? 127.0.0.0/8
May  7 22:56:32 xen1 postfix/smtpd[5964]: lost connection after HELO from localhost[127.0.0.1]
May  7 22:56:32 xen1 postfix/smtpd[5964]: disconnect from localhost[127.0.0.1]
May  7 22:56:32 xen1 postfix/smtpd[5964]: master_notify: status 1
May  7 22:56:32 xen1 postfix/smtpd[5964]: connection closed

RE: Redmine-Administration-Notification -- An error occurred while sending mail - Added by Barry Reddy about 11 years ago

Just to follow up, I've confirmed that mail can send from the server redmine is installed on.
It is not to all appearances a postix configuration problem. Postfix can send mail without
error internally within my lan, and externally to the internet.

when I attempt to send the test message within Redmine, postfix, which logs to /var/log/mail.log
via syslog does NOT see any attempt to send mail. When I send mail from this server using any
method other than Redmine, postfix logs it accordingly, even if its a deliberately malformed
email.

When I send from redmine, postfix doesn't log anything, success or failure.

I have config.action_mailer.logger = nil # commented out in the /opt/redmine/config/environments
production.rb file, a snapshot of the debug output relating to an attempt to send test mail is

posted below 

Processing AdminController#test_email (for 172.20.5.112 at 2008-05-12 20:32:37) [GET]
  Session ID: 6033a416d000b2ffb192f4137bc6fd99
  Parameters: {"action"=>"test_email", "controller"=>"admin"} Sent mail:
 From: barryr@mydomain.com
To: barryr@mydomain.com
Subject: Redmine test
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary=mimepart_4828a96549469_c25..fdbe6aba823a8
X-Mailer: Redmine
X-Redmine-Site: Redmine
X-Redmine-Host: redmine.mydomain.lan

--mimepart_4828a96549469_c25..fdbe6aba823a8
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: Quoted-printable
Content-Disposition: inline

This is a test email sent by Redmine.
Redmine URL: http://redmine.mydomain.lan/

----------------------------------------
You have received this notification because you have either subscribed to=  it, or are involved in it.
To change your notification preferences, please click here: http://redmin= e.mydomain.lan

--mimepart_4828a96549469_c25..fdbe6aba823a8
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: Quoted-printable
Content-Disposition: inline

<html>
<head>
<style>
body { font-family: Verdana, sans-serif; font-size: 0.8em; color:#484848;=  } body h1 { font-family: "Trebuchet MS", Verdana, sans-serif; font-size: 1.= 2em; margin: 0;} a, a:link, a:visited{ color: #2A5685; } a:hover, a:active{ color: #c61a1a; } hr { width: 100%; height: 1px; background: #ccc; border: 0; } .footer { font-size: 0.8em; font-style: italic; } </style> </head> <body> <p>This is a test email sent by Redmine.<br /> Redmine URL: <a href=3D"http://redmine.mydomain.lan/">http://redmine=
.mydomain.lan/</a></p>

<hr />
<span class=3D"footer"><p>You have received this notification because you=  have either subscribed to it, or are involved in it.<br />To change your=  notification preferences, please click here: <a class=3D"external" href=3D= "http://redmine.mydomain.lan">http://redmine.mydomain.lan</a></=
p></span>
</body>
</html>

--mimepart_4828a96549469_c25..fdbe6aba823a8--
Redirected to http://redmine.mydomain.lan/settings/edit?tab=notifications
Completed in 0.01656 (60 reqs/sec) | DB: 0.00000 (0%) | 302 Found [http://redmine.mydomain.lan/admin/test_email]

Processing SettingsController#edit (for 172.20.5.112 at 2008-05-12 20:32:37) [GET]
  Session ID: 6033a416d000b2ffb192f4137bc6fd99
  Parameters: {"action"=>"edit", "controller"=>"settings", "tab"=>"notifications"} Rendering template within layouts/base Rendering settings/edit Completed in 0.89629 (1 reqs/sec) | Rendering: 0.89263 (99%) | DB: 0.00000 (0%) | 200 OK [http://redmine.mydomain.lan/settings/edit?tab=notifications]

I'm not sure where else to look in redmine for errors or attempts to send mail, I could
search through the complete install tree for references to "mail", but I'm hoping there
is a more direct knowledge of where I can go to debug this.

Thanks.

RE: Redmine-Administration-Notification -- An error occurred while sending mail - Added by SyRenity Now almost 11 years ago

Hi.

I have same exact problem, while using postfix (sendmail works fine) and not Exchange.

I tried following the instructions such as config.action_mailer.delivery_method = :sendmailm but it didn't help, I still got the "501 Syntax: HELO hostname" error.

Any idea how this can be fixed?

RE: Redmine-Administration-Notification -- An error occurred while sending mail - Added by James Turnbull almost 11 years ago

What does your Postfix log say? That error usually comes from Postfix when reject_invalid_hostname is enabled - that returns a 501 - see http://www.postfix.org/spam.html.

Regards

James Turnbull

RE: Redmine-Administration-Notification -- An error occurred while sending mail - Added by SyRenity Now over 10 years ago

Hi.

I think you correct - here is whayt I have on logs:

Sep 22 18:51:09 redminepm postfix/smtpd21569: connect from localhost[127.0.0.1]
Sep 22 18:51:09 redminepm postfix/smtpd21569: lost connection after HELO from localhost[127.0.0.1]
Sep 22 18:51:09 redminepm postfix/smtpd21569: disconnect from localhost[127.0.0.1]

Disabling this option should resolve it, correct?

Thanks.

RE: Redmine-Administration-Notification -- An error occurred while sending mail - Added by SyRenity Now over 10 years ago

SyRenity Now wrote:

Hi.

I think you correct - here is whayt I have on logs:

Sep 22 18:51:09 redminepm postfix/smtpd21569: connect from localhost[127.0.0.1]
Sep 22 18:51:09 redminepm postfix/smtpd21569: lost connection after HELO from localhost[127.0.0.1]
Sep 22 18:51:09 redminepm postfix/smtpd21569: disconnect from localhost[127.0.0.1]

Disabling this option should resolve it, correct?

Thanks.

Checked it and there is no such option in the config files.

RE: Redmine-Administration-Notification -- An error occurred while sending mail - Added by SyRenity Now over 10 years ago

Hi.

Can someone comment on above?

I looked for the "reject_invalid_hostname" in the config file, but just can't find it.

Regards.

RE: Redmine-Administration-Notification -- An error occurred while sending mail - Added by SyRenity Now over 10 years ago

Also, I should mention that sending email via command line (i.e. mail email_address) works well - so it must be something RedMine related.

Thanks in advance.

RE: Redmine-Administration-Notification -- An error occurred while sending mail - Added by SyRenity Now over 10 years ago

Ok, I got it sorted out by changing action_mailer to sendmail from smtp.

Please unify my posts into a single one.

Regards.

(1-13/13)