156
156
'rec_headers_den_mail':lambda * a:True,
157
157
'dont_auto_down_attach':lambda * a:True,
158
158
'send_pref':lambda * a: 'html',
159
'smtptls':lambda *a:True,
159
'smtptls':lambda * a:True,
162
162
_sql_constraints = [
225
225
#Type cast ids to integer
226
226
if type(ids) == list:
228
this_object = self.browse(cursor, user, id, context)
228
this_object = self.browse(cursor, user, ids, context)
230
230
if this_object.smtpserver and this_object.smtpport:
325
325
#Type cast ids to integer
326
326
if type(ids) == list:
328
this_object = self.browse(cursor, user, id, context)
328
this_object = self.browse(cursor, user, ids, context)
330
330
#First validate data
331
331
if not this_object.iserver:
372
372
self.write(cr, uid, ids, {'state':'approved'}, context=context)
373
373
# wf_service = netsvc.LocalService("workflow")
375
def smtp_connection(self, cr, uid, id, context=None):
375
def smtp_connection(self, cursor, user, id, context=None):
377
This method should now wrap smtp_connection
376
379
#This function returns a SMTP server object
377
380
logger = netsvc.Logger()
378
core_obj = self.browse(cr, uid, id, context)
381
core_obj = self.browse(cursor, user, id, context)
379
382
if core_obj.smtpserver and core_obj.smtpport and core_obj.state == 'approved':
381
serv = smtplib.SMTP(core_obj.smtpserver, core_obj.smtpport)
386
except Exception, error:
387
logger.notifyChannel(_("Power Email"), netsvc.LOG_ERROR, _("Mail from Account %s failed. Probable Reason:Could not connect to server\nError: %s") % (id, error))
390
if core_obj.smtpuname and core_obj.smtppass:
391
serv.login(core_obj.smtpuname, core_obj.smtppass)
384
serv = self._get_outgoing_server(cursor, user, id, context)
392
385
except Exception, error:
393
386
logger.notifyChannel(_("Power Email"), netsvc.LOG_ERROR, _("Mail from Account %s failed on login. Probable Reason:Could not login to server\nError: %s") % (id, error))