c2c-oerpscenario team mailing list archive
-
c2c-oerpscenario team
-
Mailing list archive
-
Message #02262
[Bug 556400] Re: [NEW]improving smtpclient module behaviour
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
** Changed in: openobject-addons
Status: Triaged => Won't Fix
--
[NEW]improving smtpclient module behaviour
https://bugs.launchpad.net/bugs/556400
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
Status in OpenObject Addons Modules: Won't Fix
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.