Try ERPNext Buy Support Partners Foundation

Not able to setup Email Account with G-Suite email account

I am trying to setup G-Suite email with erp but getting following errors, I tried some alternative but it’s not working.

Tried with G-Suite email and password and showing the error below:

Tried with G-Suite application password and showing the error below:


Error traceback:

[Log] Traceback (most recent call last): (desk.min.js, line 1)
  File "/home/navdeep-pro/navdeep-pro/apps/frappe/frappe/email/doctype/email_account/email_account.py", line 168, in get_incoming_server
    email_server.connect()
  File "/home/navdeep-pro/navdeep-pro/apps/frappe/frappe/email/receive.py", line 43, in connect
    return self.connect_imap()
  File "/home/navdeep-pro/navdeep-pro/apps/frappe/frappe/email/receive.py", line 54, in connect_imap
    self.imap.login(self.settings.username, self.settings.password)
  File "/usr/lib/python3.6/imaplib.py", line 598, in login
    raise self.error(dat[-1])
imaplib.IMAP4.error: b'[ALERT] Application-specific password required: https://support.google.com/accounts/answer/185833 (Failure)'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/navdeep-pro/navdeep-pro/apps/frappe/frappe/desk/form/save.py", line 22, in savedocs
    doc.save()
  File "/home/navdeep-pro/navdeep-pro/apps/frappe/frappe/model/document.py", line 273, in save
    return self._save(*args, **kwargs)
  File "/home/navdeep-pro/navdeep-pro/apps/frappe/frappe/model/document.py", line 309, in _save
    self.run_before_save_methods()
  File "/home/navdeep-pro/navdeep-pro/apps/frappe/frappe/model/document.py", line 893, in run_before_save_methods
    self.run_method("validate")
  File "/home/navdeep-pro/navdeep-pro/apps/frappe/frappe/model/document.py", line 794, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "/home/navdeep-pro/navdeep-pro/apps/frappe/frappe/model/document.py", line 1064, in composer
    return composed(self, method, *args, **kwargs)
  File "/home/navdeep-pro/navdeep-pro/apps/frappe/frappe/model/document.py", line 1047, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "/home/navdeep-pro/navdeep-pro/apps/frappe/frappe/model/document.py", line 788, in <lambda>
    fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
  File "/home/navdeep-pro/navdeep-pro/apps/frappe/frappe/email/doctype/email_account/email_account.py", line 68, in validate
    self.get_incoming_server()
  File "/home/navdeep-pro/navdeep-pro/apps/frappe/frappe/email/doctype/email_account/email_account.py", line 170, in get_incoming_server
    message = e.message.lower().replace(" ","")
AttributeError: 'error' object has no attribute 'message'

[Log] Traceback (most recent call last): (desk.min.js, line 1)
  File "/home/navdeep-pro/navdeep-pro/apps/frappe/frappe/email/doctype/email_account/email_account.py", line 168, in get_incoming_server
    email_server.connect()
  File "/home/navdeep-pro/navdeep-pro/apps/frappe/frappe/email/receive.py", line 43, in connect
    return self.connect_imap()
  File "/home/navdeep-pro/navdeep-pro/apps/frappe/frappe/email/receive.py", line 54, in connect_imap
    self.imap.login(self.settings.username, self.settings.password)
  File "/usr/lib/python3.6/imaplib.py", line 598, in login
    raise self.error(dat[-1])
imaplib.IMAP4.error: b'[ALERT] Application-specific password required: https://support.google.com/accounts/answer/185833 (Failure)'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/navdeep-pro/navdeep-pro/apps/frappe/frappe/app.py", line 62, in application
    response = frappe.api.handle()
  File "/home/navdeep-pro/navdeep-pro/apps/frappe/frappe/api.py", line 56, in handle
    return frappe.handler.handle()
  File "/home/navdeep-pro/navdeep-pro/apps/frappe/frappe/handler.py", line 22, in handle
    data = execute_cmd(cmd)
  File "/home/navdeep-pro/navdeep-pro/apps/frappe/frappe/handler.py", line 61, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "/home/navdeep-pro/navdeep-pro/apps/frappe/frappe/__init__.py", line 1055, in call
    return fn(*args, **newargs)
  File "/home/navdeep-pro/navdeep-pro/apps/frappe/frappe/desk/form/save.py", line 22, in savedocs
    doc.save()
  File "/home/navdeep-pro/navdeep-pro/apps/frappe/frappe/model/document.py", line 273, in save
    return self._save(*args, **kwargs)
  File "/home/navdeep-pro/navdeep-pro/apps/frappe/frappe/model/document.py", line 309, in _save
    self.run_before_save_methods()
  File "/home/navdeep-pro/navdeep-pro/apps/frappe/frappe/model/document.py", line 893, in run_before_save_methods
    self.run_method("validate")
  File "/home/navdeep-pro/navdeep-pro/apps/frappe/frappe/model/document.py", line 794, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "/home/navdeep-pro/navdeep-pro/apps/frappe/frappe/model/document.py", line 1064, in composer
    return composed(self, method, *args, **kwargs)
  File "/home/navdeep-pro/navdeep-pro/apps/frappe/frappe/model/document.py", line 1047, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "/home/navdeep-pro/navdeep-pro/apps/frappe/frappe/model/document.py", line 788, in <lambda>
    fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
  File "/home/navdeep-pro/navdeep-pro/apps/frappe/frappe/email/doctype/email_account/email_account.py", line 68, in validate
    self.get_incoming_server()
  File "/home/navdeep-pro/navdeep-pro/apps/frappe/frappe/email/doctype/email_account/email_account.py", line 170, in get_incoming_server
    message = e.message.lower().replace(" ","")
AttributeError: 'error' object has no attribute 'message'

I think I need to enable the settings for less secure app.

For Mail, yes. prior to setting up the email, make sure this is enabled.

Also quick steps:

  1. Create new email account
  2. Do not add Domain. Select GMail is Service.
  3. Select incoming/outgoing/IMAP as required.

It’s worked!

I just enabled settings(from g-suite) for less secure app and it’s working now.
Even with the domain name settings.

Thank you @kennethsequeira

1 Like

Hello,

I am facing same problem also enabled settings for less secure app of my Gsuite account.

But still not able to create email account, it is giving invalid user or support password while i have checked and credentials are correct.

Please help me out ,it is so urgent for me.

Thanks in advance.

Regards,
Vishakha Mishra

I am not an expert, but you might try a password that does NOT have special characters. That worked for me at one point.

Thank You
MichaelPinkowski

I have tried some other workarounds and found my less secure app setting was on, now email account is working fine.

Regards,
Vishakha Mishra