New IMAP integration: Extending Message Length and Usage Guidelines

Hello there,

I see there is a issue logged highlighting the problem: IMAP integration body limited to 2048, was not an issue for imap_email_content · Issue #93138 · home-assistant/core · GitHub and a PR to provide a option that can be used to address it by providing a option to allow for longer message size in the event content: Add advanced imap option to set custom event max message size #93163.

From what I can see I think the update has been made(?), but I can’t see in the IMAP documentation how to use the new option. It does hint in the IMAP documentation that message length can be something other than default on line that says: The email body text of the message (by default, only the first 2048 bytes will be available.).

Could someone point out where in the documentation I missed the info on the new option, and maybe provide me an example of how my code below can be modified to increase the message/text length?

Thank you :slightly_smiling_face:

- trigger:
    - platform: event
      event_type: "imap_content"
      id: "testing_new_imap_integration"
    - name: test_imap_sensor
      state: "{{['subject'] }}"
        Message: "{{['text'] }}"
        Server: "{{['server'] }}"
        Username: "{{['username'] }}"
        Search: "{{['search'] }}"
        Folder: "{{['folder'] }}"
        Sender: "{{['sender'] }}"
        Date: "{{['date'] }}"
        Subject: "{{['subject'] }}"
        To: "{{['headers'].get('Delivered-To', ['n/a'])[0] }}"
        Return-Path: "{{['headers'].get('Return-Path',['n/a'])[0] }}"
        Received-first: "{{['headers'].get('Received',['n/a'])[0] }}"
        Received-last: "{{['headers'].get('Received',['n/a'])[-1] }}"

The option is in the integration configuration where it says Max Message Size:

No change to your sensor configuration is necessary to change the max message size. However, keep in mind that the state of an entity is limited to 255 characters, so if you want to have the totality of the allotted message available you will need to add an attribute for subject.

1 Like

Thanks Drew! Thanks for the pro-tip on the entity state, I did already find that in testing if the state exceeds the limit the sensor doesn’t load.

My options window doesn’t look like that though!:

I think I found it. It says in the documentation you need to enable Advanced Mode for your profile.

The option is there! Yay! I love this new IMAP integration. Good work to whoever worked on it!