email problems - v4-beta4

Questions and bug reports for Beta releases should be posted here.
Forum rules
Help us help you:
  • Tell us what system you run SABnzbd on.
  • Adhere to the forum rules.
  • Do you experience problems during downloading?
    Check your connection in Status and Interface settings window.
    Use Test Server in Config > Servers.
    We will probably ask you to do a test using only basic settings.
  • Do you experience problems during repair or unpacking?
    Enable +Debug logging in the Status and Interface settings window and share the relevant parts of the log here using [ code ] sections.
Post Reply
pault
Newbie
Newbie
Posts: 8
Joined: May 11th, 2008, 10:50 am

email problems - v4-beta4

Post by pault »

Hi,

Been trying v4-beta4 and so far not been able to get an email to work, this did work for me on v3.4

My settings are as follows (removed real address)
Mail for my domain is hosted by google apps, so using one of their mail servers, which will happily relay as it is email for a domain they host.
email_server = ASPMX.L.GOOGLE.COM
email_to = [email protected]
email_from = [email protected]

With log_level=2 I get this in the logs.

2008-05-11 15:32:37,353::INFO::[email] Connecting to server ASPMX.L.GOOGLE.COM:25
2008-05-11 15:32:37,610::ERROR::[email] Failed to connect to mail server

Any more ideas what else I can check or debug?

Thanks

ps. This app is excellent, thanks!
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: email problems - v4-beta4

Post by shypike »

I would be tempted to say that l.google.com doesn't stick to standards.
But in reality, I simply don't know.
Does this mail server have any documentation?

The previous (Perl-based) sendEmail solution was more robust than the current implementation.
It was also a great overkill for what we want to do. And also a burden for the Linux users
who had to have Perl and a bunch of Perl modules installed.
pault
Newbie
Newbie
Posts: 8
Joined: May 11th, 2008, 10:50 am

Re: email problems - v4-beta4

Post by pault »

Hi,

It appears to behave in SMTP speak, I can telnet to it and send a message.
$ telnet aspmx.l.google.com 25
Trying 64.233.185.27...
Connected to aspmx.l.google.com (64.233.185.27).
Escape character is '^]'.
220 mx.google.com ESMTP 9si13540264wrl.31
HELO HOST.MYDOMAIN.COM
250 mx.google.com at your service
MAIL FROM:
250 2.1.0 OK
RCPT TO:
250 2.1.5 OK
DATA
354 Go ahead
To: "ME"
From: "SAB Downloader"
Subject: This is a test
Here is the body
.
250 2.0.0 OK 1210617639 9si13540264wrl.31

Can you point me to snippet in your code that sends the email and I'll have a try myself, only just started doing anything with python, but up for a challenge!

Thanks
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: email problems - v4-beta4

Post by shypike »

Look for "def email_send(header, message):" in the file email.py.

It's more than just a snippet of code.
Apart from the "email_send" procedure, you also need the module utils/ssmtplib.py.

I don't think I can test, since google is not going to accept my IP address.
Last edited by shypike on May 12th, 2008, 1:53 pm, edited 1 time in total.
pault
Newbie
Newbie
Posts: 8
Joined: May 11th, 2008, 10:50 am

Re: email problems - v4-beta4

Post by pault »

Thanks, I made some progress and discovered a few things.

In

Code: Select all

def email_send(header, message):
  it tries to make a SMTP_SSL connection and if an exception occurs looks at the errorcode to decide that to do next. It will then only try a non-SSL SMTP connection if the error code was =1.

When I try and make a connection to ASPMX.L.GOOGLE.COM the ErrorCode I get back is 49-[Can't assign requested address], python socket error codes called this 'EADDRNOTAVAIL'.

Does this make sense as a valid response, basically SSL is not supported, we are trying to connect on port 465, which is does not support.

If I change the code to accept this is a valid failure for not supporting SSL, like errorcode=1 does, then it tries the connection to SMTP without SSL and the email gets sent

Code: Select all

if errorcode[0] == 1:
became

Code: Select all

if errorcode[0] == 1 or errorcode[0] == 49:

You will be able to send email via the same SMTP server, providing you are sending email to a google hosted account (so any @gmail.com or anyone who is using google to host email for there domain - Google Apps)

Thanks
Paul
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: email problems - v4-beta4

Post by shypike »

So, just always re-trying in non-secure mode after a failed secure mail attempt, will solve this problem?
I'll discuss this with the author of email.py.

The odd thing is, when I try this call

Code: Select all

mailconn = ssmtplib.SMTP_SSL("ASPMX.L.GOOGLE.COM", 25)
I get this exception:

Code: Select all

socket.sslerror: (1, 'error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol')
So it does contain the "1" that is tested for.

Can you use secure email for your ASPMX mails?
Post Reply