[NEW]improving smtpclient module behaviour

Bug #556400 reported by Alberto Luengo Cabanillas (Pexego)
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Won't Fix
Wishlist
Unassigned

Bug Description

Hi all.

Installing smtpclient module in a new OpenERP production environment under FreeBSD OS, it has been detected an error in "_check_queue" cron function. This function collects not-sent mails from "email.smtpclient.queue" object and tries to deliver them; to archieve this, "_send_emails" function is called. Well, the first instruction of this method does a "ping" call on google.com with certain parameters to check if there's an Internet connection available. IMHO this isn't efficient nor recomendable because of these reasons:

1.- You can have Internet connection, but your e-mail server may be down.
2.- Used parameters in "ping" call aren't available under FreeBSD ("W" instead of "w", etc)
3.- With a server under a jail environment, this "ping" call doesn't retrieve any results.
4.- Perhaps your openerp implementation is inside an intranet, with no internet access at all.
5.- Even with Internet access, perhaps a firewall is blocking icmp traffic, but not tcp traffic for smtp requests.

To prevent this, a patch has been attached for "smtpclient.py" file. This patch overrides various functions' behaviour in the way that is described here:

1.- "open_connection" : Now it returns a boolean value -instead of "True"- which will turn into "False" when server is down (i.e. when raises a "socket.gaierror" exception). This will be useful in "_send_emails" function to check this case.
2.- "_send_emails": When "open_connection" function is called and it returns "False", this function will return "False" as well.
3.- "test_verify_email": When it tries to verify introduced SMTP server, now it will raise an exception (instead of raising it in "open_connection").

This is a first approach, but it has been tested and it's functional. Anyway, feedback would be appreciated.

Tags: email smtp
Revision history for this message
Alberto Luengo Cabanillas (Pexego) (alberto-pexego) wrote :
Changed in openobject-addons:
importance: Undecided → Wishlist
milestone: none → 6.0
status: New → Confirmed
Revision history for this message
Fabien (Open ERP) (fp-tinyerp) wrote :

We have no plan to improve this module as it's not part of the addons modules.
The email_temaplte module is a better alternative.

Changed in openobject-addons:
status: Confirmed → Triaged
status: Triaged → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.