John, I followed your suggestion and got 2 different .py scripts for testing, I ran the following two and they both worked (after a bit of tweaking to my HOSTS file) but Trac still throws same error. Also I have SELinux disabled until I figure this issue out, so I do not believe it’s an issue with that. Got any other ideas?

 

***********************************************************

import smtplib

 

def prompt(prompt):

    return raw_input(prompt).strip()

 

fromaddr = prompt("From: ")

toaddrs  = prompt("To: ").split()

print "Enter message, end with ^D (Unix) or ^Z (Windows):"

 

# Add the From: and To: headers at the start!

msg = ("From: %s\r\nTo: %s\r\n\r\n"

       % (fromaddr, ", ".join(toaddrs)))

while 1:

    try:

        line = raw_input()

    except EOFError:

        break

    if not line:

        break

    msg = msg + line

 

print "Message length is " + repr(len(msg))

 

server = smtplib.SMTP('127.0.0.1')

server.set_debuglevel(1)

server.sendmail(fromaddr, toaddrs, msg)

server.quit()

 

 

*************************************************************

Also tried the following script

 

 

import smtplib

 

message = 'blah blah blah'

SENDER = '[EMAIL PROTECTED]'

RECIPIENT = 'my email addr here'

server = smtplib.SMTP('localhost')

response = server.sendmail(SENDER, RECIPIENT, message)

server.close()

print str(response)

 

***************************************************************

 

I used the user Apache to test (had to modify the passwd file since by default it has a shell disabled) and they both work fine.

                                                                                                                                                                                                                        James

 

 

 

 

 

 

 

James Molina wrote:
> 
>     self.server = smtplib.SMTP(self.smtp_server, self.smtp_port)
>   File "/usr/lib/python2.4/smtplib.py", line 241, in __init__
>     (code, msg) = self.connect(host, port)
>   File "/usr/lib/python2.4/smtplib.py", line 303, in connect
>     raise socket.error, msg
> error: (13, 'Permission denied')
 
This is a socket error.  It's saying that you aren't allowed to connect 
using the socket.  That means that it's an operating system issue.  I 
would suspect that it's some selinux funness.  Try sending an email as 
the user that trac runs under (probably apache or www-data).  Also, as 
said user, fire up a python shell and import smtplib and use that to 
send a test message.
 
-John

 

 

 

_______________________________________________
Trac mailing list
[email protected]
http://lists.edgewall.com/mailman/listinfo/trac

Reply via email to