Skip to content

Configuration and Email Settings

Chris edited this page Oct 24, 2022 · 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".


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


Office365 (still WIP)

  1. To allow authentication you first need to register your application at Azure App Registrations.

    1. Login at Azure Portal (App Registrations)

    2. Create an app. Set a name.

    3. In Supported account types choose "Accounts in any organizational directory and personal Microsoft accounts (e.g. Skype, Xbox, Outlook.com)", if you are using a personal account.

    4. Set the redirect uri (Web) to: https://login.microsoftonline.com/common/oauth2/nativeclient and click register. This needs to be inserted into the "Redirect URI" text box as simply checking the check box next to this link seems to be insufficent. This is the default redirect uri used by this library, but you can use any other if you want.

    5. Write down the Application (client) ID. You will need this value.

    6. Under "Certificates & secrets", generate a new client secret. Set the expiration preferably to never. Write down the value of the client secret created now. It will be hidden later on.

    7. Under Api Permissions:

      • When authenticating "on behalf of a user":
        1. add the delegated permissions for Microsoft Graph you want (see scopes).
        2. It is highly recommended to add "offline_access" permission. If not the user you will have to re-authenticate every hour.
      • When authenticating "with your own identity":
        1. add the application permissions for Microsoft Graph you want.
        2. Click on the Grant Admin Consent button (if you have admin permissions) or wait until the admin has given consent to your application.

      As an example, to read and send emails use:

      1. Mail.ReadWrite
      2. Mail.Send
      3. User.Read
Clone this wiki locally