Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(alerters): use regular text email instead of MIME #1626

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

wyardley
Copy link
Contributor

@wyardley wyardley commented Mar 5, 2025

  • Remove some extra newlines at the beginning of email alerts
  • Use regular plaintext email vs. MIME so that we receive the plain text email inline instead of as a single text/plain attachment.

While MIME has some advantages if we were sending attachments, using multipart/mixed messages to send both HTML and plaintext versions, it doesn't appear to me that we're doing that

before (notice extra line and attachment)
image

after:
image

- Remove some extra newlines at the beginning of email alerts
- Use regular plaintext email vs. MIME so that we receive the plain text
  email inline instead of as a single text/plain attachment.

While MIME has some advantages if we were sending attachments, using
multipart/mixed messages to send both HTML and plaintext versions, it
doesn't appear to me that we're doing that
@@ -434,7 +434,7 @@ def build_message(
raise NotImplementedError
elif length == AlertLength.FULL:
if alert_type in [AlertType.CATCHUP, AlertType.FAILURE]:
message = """
message = """\
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there might be other ways to suppress these newlines; this way seemed to work

@@ -62,7 +61,7 @@ def send_alert(self, name: str, monitor: Monitor) -> None:
AlertLength.NOTIFICATION, alert_type, monitor
)
body = self.build_message(AlertLength.FULL, alert_type, monitor)
message.attach(MIMEText(body, "plain"))
message.set_content(body)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if there are cases where we're sending anything other than plain ASCII text? but the tests pass 🤷

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant