Edgewall Software
Modify

Opened 19 years ago

Closed 19 years ago

Last modified 18 years ago

#1574 closed defect (invalid)

localhost is an invalid SMTP server

Reported by: rr236@… Owned by: Jonas Borgström
Priority: normal Milestone:
Component: ticket system Version: 0.8.1
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

setting smtp_server to localhost produces the following error on ticket submission:

Python traceback

Traceback (most recent call last):

File "/sw/lib/python2.3/site-packages/trac/core.py", line 525, in cgi_start

real_cgi_start()

File "/sw/lib/python2.3/site-packages/trac/core.py", line 520, in real_cgi_start

dispatch_request(path_info, args, req, env)

File "/sw/lib/python2.3/site-packages/trac/core.py", line 435, in dispatch_request

module.run()

File "/sw/lib/python2.3/site-packages/trac/Module.py", line 44, in run

self.render()

File "/sw/lib/python2.3/site-packages/trac/Ticket.py", line 298, in render

self.create_ticket()

File "/sw/lib/python2.3/site-packages/trac/Ticket.py", line 290, in create_ticket

tn.notify(ticket, newticket=1)

File "/sw/lib/python2.3/site-packages/trac/Notify.py", line 227, in notify

NotifyEmail.notify(self, ticketid, subject)

File "/sw/lib/python2.3/site-packages/trac/Notify.py", line 131, in notify

Notify.notify(self, resid)

File "/sw/lib/python2.3/site-packages/trac/Notify.py", line 79, in notify

self.begin_send()

File "/sw/lib/python2.3/site-packages/trac/Notify.py", line 139, in begin_send

self.server = smtplib.SMTP(self.smtp_server)

File "/Volumes/Backup/sw-buildroot-python23-2.3.5-2/sw/lib/python2.3/smtplib.py", line 254, in init

addr = socket.gethostbyname(socket.gethostname())

gaierror: (7, 'No address associated with nodename')

Attachments (1)

Notify.py.diff (139 bytes ) - added by rr236@… 19 years ago.
Patch against branches/0.8-stable/trac/Notify.py that resolved the issue for me

Download all attachments as: .zip

Change History (5)

comment:1 by rr236@…, 19 years ago

well, it actually appears that any attempt to send email produces this error. I installed trac from the fink package on Mac OS 10.3.6, using the fink python package.

It's probably a python error, but any assistance would be appreciated.

comment:2 by Mark Rowe, 19 years ago

Resolution: invalid
Status: newclosed

This is a configuration error on your end. You should change the smtp_server to a valid SMTP server that you are able to send mail through. If you have further trouble, please raise the issue on the mailing list so that we may help you resolve the problem.

comment:3 by rr236@…, 19 years ago

It actually wasn't a configuration issue- I have sendmail running just fine on my trac box, and I was getting that error no matter what I had smtp_server set to.

Turns out my installation of python didn't like the way Notify.py was calling smtplib.SMTP(smtp_server). Changing that constructor call to three arguments (smtp_server, port, local_hostname) resolved the issue.

I'll attach a patch.

by rr236@…, 19 years ago

Attachment: Notify.py.diff added

Patch against branches/0.8-stable/trac/Notify.py that resolved the issue for me

comment:4 by Mark Rowe, 19 years ago

The configuration error is that your computer is not able to resolve it's own hostname to an IP address. On my computer, my hostname (as returned by socket.gethostname()) is mrowe.local. It is able to correctly resolve this name to the IP address of 10.10.3.58.

mrowe:~ mrowe$ python
Python 2.4.1 (#1, May 18 2005, 13:28:20) 
[GCC 4.0.0 20041026 (Apple Computer, Inc. build 4061)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
>>> socket.gethostname()
'mrowe.local'
>>> socket.gethostbyname(socket.gethostname())
'10.10.3.58'
>>> 

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jonas Borgström.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jonas Borgström to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.