Project

General

Profile

Actions

Defect #8820

closed

Email delivery with gmail

Added by Usman Ajmal over 13 years ago. Updated over 13 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
2011-07-15
Due date:
% Done:

0%

Estimated time:
Resolution:
Affected version:

Description

I setup email using http://redmineblog.com/articles/setup-redmine-to-send-email-using-gmail/ and it was working fine i.e. sending emails fine.

But today when I clicked 'Send a test email' from the Email Notification tab of Admin's settings it returned following error:

An error occurred while sending mail (Connection reset by peer)

This error arises when I test redmine in my office (where it was working fine some days ago). At my home, I don't get this error and the emails get send properly.

How can I create debug logs to ease finding the problem? or if someone has any idea about this problem?

Actions #1

Updated by Usman Ajmal over 13 years ago

Following information may turn out useful:

ruby 1.8.7 (2010-08-16 patchlevel 302) [i686-linux]
Rack 1.1
Rails 2.3.5

email.yml:
production:
delivery_method: :smtp
smtp_settings:
tls: true
address: "smtp.gmail.com"
port: 587
domain: "smtp.gmail.com" # 'your.domain.com' for GoogleApps
authentication: :plain
user_name: "syedusmanajmal@gmail.com"
password: "MY_PASSWORD"
development:
delivery_method: :smtp
smtp_settings:
tls: true
address: "smtp.gmail.com"
port: 587
domain: "smtp.gmail.com" # 'your.domain.com' for GoogleApps
authentication: :plain
user_name: "syedusmanajmal@gmail.com"
password: "MY_PASSWORD"
test:
delivery_method: :test

sudo tcpdump -i eth1
@tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth1, link-type EN10MB (Ethernet), capture size 65535 bytes
11:42:48.311156 6c:fd:b9:24:e6:89 (oui Unknown) Unknown SSAP 0x1c > 70:1a:04:dd:c2:88 (oui Unknown) Unknown DSAP 0xf8 Supervisory, Receiver not Ready, rcv seq 74, Flags [Response], length 89
11:42:48.311166 6c:fd:b9:24:e6:89 (oui Unknown) RS511 > 70:1a:04:dd:c2:88 (oui Unknown) Null Unnumbered, 4b, Flags [Command], length 109
11:42:48.311744 70:1a:04:dd:c2:88 (oui Unknown) Unknown SSAP 0xf2 > 6c:fd:b9:24:e6:89 (oui Unknown) Unknown DSAP 0x24 Supervisory, ?, rcv seq 28, Flags [Command], length 60
11:42:48.311749 70:1a:04:dd:c2:88 (oui Unknown) Unknown SSAP 0x38 > 6c:fd:b9:24:e6:89 (oui Unknown) Unknown DSAP 0xd6 Unnumbered, 8f, Flags [Command], length 60
11:42:49.201083 6c:fd:b9:24:e6:89 (oui Unknown) Unknown SSAP 0x90 > 00:24:2b:75:58:5b (oui Unknown) SNAP Unnumbered, 47, Flags [Response], length 239
11:42:49.210601 00:24:2b:75:58:5b (oui Unknown) Unknown SSAP 0xf4 > 6c:fd:b9:24:e6:89 (oui Unknown) Unknown DSAP 0x98 Information, send seq 123, rcv seq 59, Flags [Response], length 253
11:42:49.566283 6c:fd:b9:24:e6:89 (oui Unknown) IP > 00:24:2b:75:58:5b (oui Unknown) Unknown DSAP 0x2c Unnumbered, cf, Flags [Poll], length 60
11:42:50.463345 6c:fd:b9:24:e6:89 (oui Unknown) Unknown SSAP 0xd0 > 78:e4:00:0d:38:ba (oui Unknown) Unknown DSAP 0x7c Unnumbered, 27, Flags [Response], length 140
11:42:50.504091 78:e4:00:0d:38:ba (oui Unknown) Unknown SSAP 0x10 > 6c:fd:b9:24:e6:89 (oui Unknown) Unknown DSAP 0x08 Information, send seq 77, rcv seq 22, Flags [Poll], length 60
11:42:51.119499 IP redmine.dev.39766 > a125-252-225-16.deploy.akamaitechnologies.com.www: Flags [.], ack 2220008261, win 313, options [nop,nop,TS val 1530928 ecr 3627572762], length 0
11:42:51.120981 IP redmine.dev.55623 > 192.168.1.1.domain: 62450+ PTR? 16.225.252.125.in-addr.arpa. (45)
11:42:51.219539 IP redmine.dev.48846 > a125-252-225-175.deploy.akamaitechnologies.com.www: Flags [.], ack 1785603118, win 1002, options [nop,nop,TS val 1530953 ecr 87585748], length 0
11:42:51.279521 IP redmine.dev.39764 > a125-252-225-16.deploy.akamaitechnologies.com.www: Flags [.], ack 2213444306, win 439, options [nop,nop,TS val 1530968 ecr 3627572924], length 0
11:42:51.279543 IP redmine.dev.48848 > a125-252-225-175.deploy.akamaitechnologies.com.www: Flags [.], ack 1799760366, win 469, options [nop,nop,TS val 1530968 ecr 87585809], length 0
11:42:51.335537 IP redmine.dev.48847 > a125-252-225-175.deploy.akamaitechnologies.com.www: Flags [.], ack 1787609847, win 608, options [nop,nop,TS val 1530982 ecr 87585865], length 0
11:42:51.335568 IP redmine.dev.48841 > a125-252-225-175.deploy.akamaitechnologies.com.www: Flags [.], ack 1748645895, win 1002, options [nop,nop,TS val 1530982 ecr 87585865], length 0
11:42:51.335590 IP redmine.dev.48842 > a125-252-225-175.deploy.akamaitechnologies.com.www: Flags [.], ack 1761559614, win 1002, options [nop,nop,TS val 1530982 ecr 87585865], length 0
11:42:51.385983 IP a125-252-225-16.deploy.akamaitechnologies.com.www > redmine.dev.39766: Flags [.], ack 1, win 215, options [nop,nop,TS val 3627618024 ecr 1474508], length 0
11:42:51.387298 IP a125-252-225-175.deploy.akamaitechnologies.com.www > redmine.dev.48846: Flags [.], ack 1, win 432, options [nop,nop,TS val 87630910 ecr 1474543], length 0
11:42:51.422085 IP 192.168.1.1.domain > redmine.dev.55623: 62450* 1/0/0 PTR a125-252-225-16.deploy.akamaitechnologies.com. (104)
11:42:51.422530 IP redmine.dev.47712 > 192.168.1.1.domain: 52772+ PTR? 1.1.168.192.in-addr.arpa. (42)
11:42:51.443507 IP redmine.dev.48849 > a125-252-225-175.deploy.akamaitechnologies.com.www: Flags [.], ack 1800602178, win 1002, options [nop,nop,TS val 1531009 ecr 87585978], length 0
11:42:51.460735 IP a125-252-225-16.deploy.akamaitechnologies.com.www > redmine.dev.39764: Flags [.], ack 1, win 215, options [nop,nop,TS val 3627618099 ecr 1474554], length 0
11:42:51.461539 IP a125-252-225-175.deploy.akamaitechnologies.com.www > redmine.dev.48848: Flags [.], ack 1, win 334, options [nop,nop,TS val 87630984 ecr 1474565], length 0
11:42:51.463499 IP redmine.dev.59692 > 74.125.236.34.www: Flags [.], ack 1408881957, win 262, options [nop,nop,TS val 1531014 ecr 2846256612], length 0
11:42:51.467495 IP redmine.dev.56686 > a125-252-225-9.deploy.akamaitechnologies.com.www: Flags [.], ack 2219436756, win 355, options [nop,nop,TS val 1531015 ecr 3627549958], length 0
11:42:51.489177 IP 192.168.1.1.domain > redmine.dev.47712: 52772 NXDomain* 0/1/0 (139)
11:42:51.510889 IP a125-252-225-175.deploy.akamaitechnologies.com.www > redmine.dev.48847: Flags [.], ack 1, win 333, options [nop,nop,TS val 87631045 ecr 1474570], length 0
11:42:51.511707 IP a125-252-225-175.deploy.akamaitechnologies.com.www > redmine.dev.48842: Flags [.], ack 1, win 485, options [nop,nop,TS val 87631045 ecr 1474573], length 0
11:42:51.516795 IP a125-252-225-175.deploy.akamaitechnologies.com.www > redmine.dev.48841: Flags [.], ack 1, win 518, options [nop,nop,TS val 87631045 ecr 1474568], length 0
11:42:51.590113 IP6 fe80::c617:feff:fedb:e8b5.mdns > ff02::fb.mdns: 0 PTR (QM)? 1.1.168.192.in-addr.arpa. (42)
^C11:42:51.590235 IP redmine.dev.mdns > 224.0.0.251.mdns: 0 PTR (QM)? 1.1.168.192.in-addr.arpa. (42)

@

Actions #2

Updated by Felix Schäfer over 13 years ago

Usman Ajmal wrote:

I setup email using http://redmineblog.com/articles/setup-redmine-to-send-email-using-gmail/ and it was working fine i.e. sending emails fine.

But today when I clicked 'Send a test email' from the Email Notification tab of Admin's settings it returned following error:

An error occurred while sending mail (Connection reset by peer)

This error arises when I test redmine in my office (where it was working fine some days ago). At my home, I don't get this error and the emails get send properly.

Has it ever worked at your office? I guess either you have some proxy/firewall at your office that doesn't let you talk to gmail, or gmail doesn't let you talk to it when you're at your office. You might test this by telnet smtp.gmail.com 587 from your office.

Actions #3

Updated by Usman Ajmal over 13 years ago

Yes, it worked at my office some days ago. I don't have any proxy or firewall at my office. I am connected directly to a wireless router of an ISP.
Following happens when I telnet smtp.gmail.com

$ telnet smtp.gmail.com 587
Trying 74.125.53.109...
Connected to gmail-smtp-msa.l.google.com.
Escape character is '^]'.
220 mx.google.com ESMTP z7sm524438pbk.67
_

After this the cursor keeps on blinking and nothing happens at all...

Actions #4

Updated by Felix Schäfer over 13 years ago

Usman Ajmal wrote:

Yes, it worked at my office some days ago. I don't have any proxy or firewall at my office. I am connected directly to a wireless router of an ISP.
Following happens when I telnet smtp.gmail.com

$ telnet smtp.gmail.com 587
Trying 74.125.53.109...
Connected to gmail-smtp-msa.l.google.com.
Escape character is '^]'.
220 mx.google.com ESMTP z7sm524438pbk.67
_

After this the cursor keeps on blinking and nothing happens at all…

OK, that's good, that means the connection works.

When you say it works at home but not at the office: Do you have your installation on a laptop, or do you mean an installation on some server behaves differently whether you are at home or at the office?

Actions #5

Updated by Usman Ajmal over 13 years ago

Ok first lemme quote full output of that telnet command:

~# telnet smtp.gmail.com 587
Trying 74.125.53.109...
Connected to gmail-smtp-msa.l.google.com.
Escape character is '^]'.
220 mx.google.com ESMTP z7sm524438pbk.67
451 4.4.2 Timeout - closing connection. z7sm524438pbk.67
Connection closed by foreign host.

I have installed it on my laptop. Redmine on my laptop works fine at home but not at office. When I went home I changed entry of redmine in /etc/hosts to
192.168.1.2 redmine.dev
restarted apache and then browsed to http://192.168.1.2. Finally, tried sending a test mail which worked fine.

The same laptop is now connected to internet in my office where it has been assiged IP: 192.168.1.106 so I change the redmine entry in /etc/hosts to
192.168.1.106 redmine.dev
restarted apache and then browsed to 192.168.1.106 and tried sending a test mail which returned the 'Connection Reset by peer' error.

Actions #6

Updated by Felix Schäfer over 13 years ago

Usman Ajmal wrote:

Ok first lemme quote full output of that telnet command:

~# telnet smtp.gmail.com 587
Trying 74.125.53.109...
Connected to gmail-smtp-msa.l.google.com.
Escape character is '^]'.
220 mx.google.com ESMTP z7sm524438pbk.67
451 4.4.2 Timeout - closing connection. z7sm524438pbk.67
Connection closed by foreign host.

This looks all good and well. Do you have any other program on your laptop that sends mail through smtp to gmail, a mail client for example? Does everything work well there?

I have installed it on my laptop. Redmine on my laptop works fine at home but not at office. When I went home I changed entry of redmine in /etc/hosts to
192.168.1.2 redmine.dev
restarted apache and then browsed to http://192.168.1.2. Finally, tried sending a test mail which worked fine.

The same laptop is now connected to internet in my office where it has been assiged IP: 192.168.1.106 so I change the redmine entry in /etc/hosts to
192.168.1.106 redmine.dev
restarted apache and then browsed to 192.168.1.106 and tried sending a test mail which returned the 'Connection Reset by peer' error.

You might want to just point redmine.dev to your loopback interface (127.0.0.1 should work), that way you wouldn't have to worry about changing the IP redmine.dev points too all the time.

Actions #7

Updated by Usman Ajmal over 13 years ago

This looks all good and well. Do you have any other program on your laptop that sends mail through smtp to gmail, a mail client for example? Does everything work well there?

I just tried send mail using Evolution software of Ubuntu. It sent the mail finely.
You might want to just point redmine.dev to your loopback interface (127.0.0.1 should work), that way you wouldn't have to worry about changing the IP redmine.dev points too all the time.

Okay thanks for this tip. But what if I want to access redmine from another PC on my LAN. I will need to give the IP of redmine PC, right? or is their anyway by which the user may need to just type 'http://redmine.dev' to load the redmine (installed on some other PC/server) in his browser?
Actions #8

Updated by Usman Ajmal over 13 years ago

Just found a new irritating problem.

I can login using admin's credentials but a user XYZ who registered himself an account on redmine can't login. I, as an admin, unlocked his account but when he enters correct username and password, redmine throws 'Invalid username or password' error. Admin tried to reset his password and tried to login through XYZ's account but invain. Same error popped up.

Do I need to set permissions of some file or directory of redmine right?

Info: I am not using LDAP authentication.

Actions #9

Updated by Felix Schäfer over 13 years ago

Usman Ajmal wrote:

[...]
I just tried send mail using Evolution software of Ubuntu. It sent the mail finely.

With the same settings you entered in the Redmine email config? Odd.

[...]
Okay thanks for this tip. But what if I want to access redmine from another PC on my LAN. I will need to give the IP of redmine PC, right? or is their anyway by which the user may need to just type 'http://redmine.dev' to load the redmine (installed on some other PC/server) in his browser?

I'm sorry but that's networking 101 and not really the scope of problems we handle here on the bugtracker. Maybe Etienne can help, but I don't have time to go through all this with you, sorry.

Actions #10

Updated by Usman Ajmal over 13 years ago

With the same settings you entered in the Redmine email config? Odd.

Sorry, I overlooked the security option which was set to SSL. If I set it to TLS, Evolution returns the same 'Connection reset by peer' error. Can we use SSL with redmine?

Actions #11

Updated by Usman Ajmal over 13 years ago

I have set following configuration for SSL in my email.yml

production:
   delivery_method: :smtp
   smtp_settings:
     ssl: true
     address: "smtp.gmail.com" 
     port: 587
     domain: "smtp.gmail.com" # 'your.domain.com' for GoogleApps
     authentication: :plain
     user_name: "myusername@gmail.com" 
     password: "mypassword" 

Sending a test mail returns following error:

An error occurred while sending mail (wrong number of arguments (3 for 2))

Actions #12

Updated by Usman Ajmal over 13 years ago

Okay Guys. Problem solved...atlast. phew

Here is the solution if TLS don't work out for you:

Install action_mailer_optional_tls by following executing following command in the root of redmine:
$ cd /usr/share/redmine
$ ruby script/plugin install git://github.com/collectiveidea/action_mailer_optional_tls.git

Copy smtp_tls.rb to the lib folder of your redmine:
cp /usr/share/redmine/vendor/plugins/action_mailer_optional_tls/lib/smtp_tls.rb /usr/share/redmine/lib/

Change the line 'check_auth_args user, secret, authtype if user or secret' to:
check_auth_args user, secret if user or secret

Modify /etc/redmine/default/email.yml to following:

production:
  delivery_method: :smtp
  smtp_settings:
    address: "smtp.gmail.com" 
    tls: false
    ssl: true
    port: '465' # These marks around 465 are must other Connection reset by peer error will arise
    domain: "smtp.gmail.com" 
    authentication: :plain
    user_name: "myaccount@gmail.com" 
    password: "MY_PASSWORD" 

Click 'Send a test email' from the Email Notifications settings of your Redmine's admin settings.

Actions #13

Updated by Jean-Philippe Lang over 13 years ago

  • Subject changed from Working Redmine stopped working to Email delivery with gmail
  • Status changed from New to Closed
Actions

Also available in: Atom PDF