diff --git a/homeassistant/components/google_mail/notify.py b/homeassistant/components/google_mail/notify.py index 4fa89b4615f5..5c3c220ed75d 100644 --- a/homeassistant/components/google_mail/notify.py +++ b/homeassistant/components/google_mail/notify.py @@ -8,11 +8,9 @@ from typing import Any, override from googleapiclient.http import HttpRequest from homeassistant.components.notify import ( - ATTR_DATA, - ATTR_TARGET, - ATTR_TITLE, ATTR_TITLE_DEFAULT, BaseNotificationService, + NotifyServiceArgument, ) from homeassistant.core import HomeAssistant from homeassistant.exceptions import ServiceValidationError @@ -50,11 +48,11 @@ class GMailNotificationService(BaseNotificationService): @override async def async_send_message(self, message: str, **kwargs: Any) -> None: """Send a message.""" - data: dict[str, Any] = kwargs.get(ATTR_DATA) or {} - title = kwargs.get(ATTR_TITLE, ATTR_TITLE_DEFAULT) + data: dict[str, Any] = kwargs.get(NotifyServiceArgument.DATA) or {} + title = kwargs.get(NotifyServiceArgument.TITLE, ATTR_TITLE_DEFAULT) email = MIMEText(message, "html") - if to_addrs := kwargs.get(ATTR_TARGET): + if to_addrs := kwargs.get(NotifyServiceArgument.TARGET): email["To"] = ", ".join(to_addrs) email_from = data.get(ATTR_FROM, ATTR_ME)