mirror of
https://github.com/NaN-tic/trytond-csv_import_getmail.git
synced 2023-12-13 21:30:35 +01:00
Get email from from_addr message attribute
This commit is contained in:
parent
2b966b9824
commit
4b7341a24d
|
@ -15,19 +15,23 @@ class CSVProfile(ModelSQL, ModelView):
|
|||
'profile', 'party', 'Parties')
|
||||
|
||||
@classmethod
|
||||
def getmail(cls, messages, attachments=None):
|
||||
def getmail(self, messages, attachments=None):
|
||||
pool = Pool()
|
||||
GetMail = pool.get('getmail.server')
|
||||
CSVArchive = pool.get('csv.archive')
|
||||
CSVProfile = pool.get('csv.profile')
|
||||
|
||||
for (_, message) in messages:
|
||||
for (messageid, message) in messages:
|
||||
if not message.attachments:
|
||||
logging.getLogger('Getmail CSV Import').info(
|
||||
'Not attachments. Continue')
|
||||
continue
|
||||
if not message.from_addr:
|
||||
logging.getLogger('Getmail CSV Import').info(
|
||||
'Not from address email. Continue')
|
||||
continue
|
||||
|
||||
sender = GetMail.get_email(message.sender)
|
||||
sender = GetMail.get_email(message.from_addr[1:-1])
|
||||
party, _ = GetMail.get_party_from_email(sender)
|
||||
if not party:
|
||||
logging.getLogger('Getmail CSV Import').info(
|
||||
|
|
Loading…
Reference in a new issue