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

Link in Mail-Adress confirmation message incomplete on Apple mail #614

Open
DanielMorsch opened this issue Feb 2, 2025 · 2 comments
Open

Comments

@DanielMorsch
Copy link

Hi,

just noticed that the link for the mail-adress confirmation message or the Password reset message is incomplete.

it seems as if the Apple mail app on macOS or iOS gets stuck at a point in the jwt token and thus only half of the link is really detected as a link.

Like this one:

Image

On Gmail the same mail looks good. The whole link is detected.

Would it be possible to design the e-mail with a little html code? Then a button could be created to go directly to the link. At the moment I find the emails a bit too “technical”.

@DavidMStraub
Copy link
Member

Yes I think that's a good idea!

Do you want to give it a shot? Actually, I have some code for Grampshub confirmation e-mails that we can directly use.

We need to add to the send_email function:

  • new argument body_html: str | None = None
  • Replace msg.set_content(body) by
    msg.set_content(body)
    if body_html:
        msg.add_alternative(body_html, subtype="html")

And then the various functions like email_confirm_email have to be adapted - probably we can return a tuple of body, body_html.

A snippet to reuse for an HTML button:

def url_as_button(url: str, button_label: str) -> str:
    return f"""
        <a href="{url}" style="background-color: #6D4C41; color: white;
            padding: 10px 20px; text-decoration: none; border-radius: 4px;
            font-family: sans-serif;">
            {button_label}
        </a>
    """

body = f"{text}\n\n{url}"
body_html = f"""
<p>{text}</p>
<p style="text-align: center;">
{url_as_button(url, "some_button_label")}
</p>
"""

@DanielMorsch
Copy link
Author

Oh great 👍 i will give it a try.

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

No branches or pull requests

2 participants