Developer Interface

Main Interface

All of sesparser functionality can be accessed by these 2 methods. They all return an instance of the python dictionary object.

sesparser.online(event, dynamodb=False, table_name='', region_name='us-east-1', inline=True)
sesparser.offline(email_message, message_type='bytes', inline=True)

Handling Attachments

sesparser.attachments.get_file_type(filename)

This function gives MIME Type of the filename For example document.pdf => output = application/pdf it’s mainly used to detect attachment file type of the email and also for uploading a file to S3 bucket with filetype variable

Parameters:

filename (string) – Name of the file, for e.g. some_document.pdf

Returns:

MIME type of the given file, for e.g. application/pdf

Return type:

string

sesparser.attachments.extract_attachments_from_part(part)

This Function extracts the email attachment part by providing the email message part

Parameters:

part – _description_

Returns:

_description_

Return type:

_type_

sesparser.attachments.extract_attachments(email_message)
sesparser.attachments.inline_attachments(attachments_list, html_body)
sesparser.attachments.inline_handler(attachments_data, body_data)

Handling Body part

sesparser.body.get_charset(email_message)
sesparser.body.get_body_from_part(part)
sesparser.body.get_body(email_message)

Parsing Email Headers

sesparser.headers.decode_header_value(value)
sesparser.headers.convert_to_utc(email_message)
sesparser.headers.security_results(email_message)
sesparser.headers.all_message_id(email_message)
sesparser.headers.persons(email_message)
sesparser.headers.subject(email_message)
sesparser.headers.other_headers()

This creates manual additional headers such as email read status and important marking status

Returns:

The values of is_read and is_starred

Return type:

dict

sesparser.headers.headers(email_message)

Core Backend

sesparser.main.offline(email_message, message_type='bytes', inline=True)
sesparser.main.online_dynamodb(inputs, table_name, region_name)
sesparser.main.online(event, dynamodb=False, table_name='', region_name='us-east-1', inline=True)

Email Message Object Generation

sesparser.parse_it.parse_email_only(email_message, message_type)

AWS Backend Integration

sesparser.store_aws.handle_s3(output, recipient_list, s3, bucket_name, main_object_key)