Skip to content

Configuration and Email Settings

Chris edited this page Jun 25, 2024 · 37 revisions

Installation and Updates

HACS (Recommended)

  1. Have HACS installed, this will allow you to easily update
  2. Click Integrations then click the + in the lower right corner and type in Mail and Packages
  3. Click install under "Mail and Packages", restart your instance.

Manual Installation

  1. Download this repository as a ZIP (green button, top right) and unzip the archive
  2. Copy the mail_and_packages folder inside the custom_components folder to the Home Assistant /<config path>/custom_components/ directory
    • You may need to create the custom_components in your Home Assistant installation folder if it does not exist
    • On Home Assistant (formerly Hass.io) and Home Assistant Container the final location should be /config/custom_components/mail_and_packages
    • On Home Assistant Supervised, Home Assistant Core, and Hassbian the final location should be /home/homeassistant/.homeassistant/custom_components/mail_and_packages
  3. Restart your instance.

Note: If the integration does not show up, refresh the Integrations page.

Enabling Betas

HACS (Recommended)

  1. Have HACS installed, this will allow you to easily switch between beta and stable.
  2. Open HACS
  3. Click on Integrations
  4. Click the overflow menu (the 3 dots) in the bottom right of Mail and Packages
  5. Select Redownload from the menu
  6. Check/Enable the Show beta versions
  7. Select the latest beta from the list and press the Download button

Configuration

Once you have finished installing through HACS or manually go into Configuration -> Integration select the +and add the Mail And Packages integration. This is a two step process.

Re-configuration

If you for some reason need to modify your settings instead of removing the integration and re-adding. Go into Configuration -> Integration select the Configure button on Mail And Packages to re-configure the settings.

Step 1

Notes about specific email providers.

Setting Description
Host The address provided by your email host.
Port The port provided by your email host.
Email The email address you receive notification emails.
Password The password for your email account.

Checking multiple email boxes

In order to check multiple email boxes just add the integration again with the credentials for the additional mail provider you are using. This will create another set of sensors for you that will update based on those emails.

Step 2

Setting Description
Mail Folder The folder in your email account that the notification messages are stored. The default is Inbox.
Sensor List Choose the sensors to activate that coordinate with the shipping providers you want to track.
Amazon forwarded email addresses Provide the email addresses that you will forward amazon notification from. For multiple, please separate each address with a comma.
Scanning Interval (minutes) The amount of time that will pass between checking for new email notifications.
Time in seconds before connection timeout Increase the time if your mail provider has a slow connection to allow more time to connect too the mail server.
Image Duration (seconds) The amount of time each USPS Informed Delivery image is shown in the generated rotating GIF.
Create mp4 from image Create an MP4 fo the USPS Informed Delivery image for possible future use.
Allow external image use* Save the image to /path/to/config/www/mail_and_packages/ so it is accessible to use in iOS and Android notifications.
*Privacy / Security Note

Please note that files stored in the www Home Assistant folder are publicly accessible unless you have taken security measures outside of Home Assistant to secure it. For increased security and simplicity the USPS Informed Delivery image name is random by default and no longer has the option to turn it on/off. Two new sensors have been created that provide the local file path or a web accessible url for use in displaying or sending in various Home Assistant notification methods.

  • sensor.mail_image_system_path
  • sensor.mail_image_url - Requires that either External_URL or Internal_URL is defined in the general configuration options in Home Assistant.

Email Provider Notes

GMail

Please note if you are using GMail for this you will need to setup an App Password in order for this to work. Please refer to this link for details on how to setup an App Password

Additional information on GMail settings are here under "Set up Gmail with older versions of Outlook and other clients".

OAuth Setup

This section explains how to generate a client ID and client secret on Google Developers Console.

  1. First, go to the Google Developers Console to enable GMail API.
  2. Select Create project, enter a project name and select Create.
  3. Enable the GMail API.
  4. Navigate to APIs & Services (left sidebar) > Credentials.
  5. In the left sidebar, select OAuth consent screen.
  6. Select External and Create.
  7. Set the App name (the name of the application asking for consent) to anything you want, e.g., Home Assistant.
  8. You then need to select a Support email.
  9. From the dropdown menu, select your email address.
  10. Under Developer contact information, enter your email address (the same as above is fine).
  11. Scroll to the bottom and select Save and continue.
  12. You don’t have to fill out anything else here. Adding other information to this page (like an app logo) may trigger an additional review process from Google and delay setup by days.
  13. You will then be automatically taken to the Scopes page.
  14. You do not need to add any scopes here. Select Save and continue to move to the Test users page.
  15. You do not need to add anything to the Test users page. Select Save and continue, which will take you to the Summary page.
  16. Select Back to dashboard.
  17. Select OAuth consent screen again and under Publishing status, select Publish app.
  18. Otherwise your credentials will expire every 7 days.
  19. Make sure Publishing status is set to In production.
  20. In the left sidebar, select Credentials, then select Create credentials (at the top of the screen), then select OAuth client ID.
  21. Set the Application type to Web application and give this credential set a name (like “Home Assistant Credentials”).
  22. Add https://my.home-assistant.io/redirect/oauth to Authorized redirect URIs then select Create.
  23. This is not a placeholder. It is the URI that must be used.
  24. You will then be presented with a pop-up saying OAuth client created, showing Your client ID and Your client secret.
  25. Make a note of these (for example, copy and paste them into a text editor), as you will need them shortly.
  26. Once you have noted these strings, select OK.
  27. If you need to find these credentials again at any point, then navigate to APIs & Services > Credentials, and you will see Home Assistant Credentials (or whatever you named them in the previous step) under OAuth 2.0 Client IDs.
  28. To view both the Client ID and Client secret, select the pencil icon. This will take you to the settings page for these credentials, and the information will be on the right-hand side of the page.
  29. Congratulations! You are now the keeper of a client secret. Guard it in your treasure box. In most cases your new credentials will be active within a few moments. However, Google states that activation may take up to five hours in some circumstances.

Yahoo Mail

Nothing special is required to setup a Yahoo Mail account in this component, just enter your username (your Yahoo Email address) and password as normal. If you have 2FA enabled you will need to generate an app password as outlined on the Yahoo help pages.

References:

Server Settings

App Passwords


Hotmail/Outlook/Live

Nothing special is required to setup a Yahoo Mail account in this component, just enter your username (your Outlook/Hotmail/Live Email address) and password as normal.

Reference: Here


Office 365 (WIP)

  • Register a new application in Azure AD
    • Name your app
    • Select "Personal Microsoft accounts only" under supported account types
    • For Redirect URI, add: https://my.home-assistant.io/redirect/oauth
  • Copy your Application (client) ID for later use
  • Copy your Tenant ID for later use
  • On the App Page, navigate to "Certificates & secrets"
    • Generate a new client secret and save for later use

Proton Mail

  1. Set up Proton Mail Bridge (docker container). If you are using the container, make sure you run the info command after initial set up to get the connection details for the bridge. If you are not using the docker container, you probably need to forward the port for IMAP with socat since it is bound to 127.0.0.1 by mail bridge.
  2. Add Integration with credential details given by mail bridge. Should be using startTLS and No verification of SSL cert. Username and password provided by mail bridge.