Prompt

How do I send mention notification emails?

Technology / Api platforms1 observationLast seen Sep 23, 2026

Latest observation

Sep 23, 2026OpenAI APIWeb search: off

To send mention notification emails, your app usually needs to do two things:

  1. Detect the mention in whatever content is being posted.
  2. Send an email to the mentioned user(s) when the post is saved.

A typical flow looks like this:

1) Detect mentions

When a user writes something like:

Hey @alice, can you review this?

Parse the text for @username patterns, then look up matching users in your database.

Example logic:

  • Extract alice
  • Find user record for alice
  • Check whether the user has notifications enabled

2) Create a notification record

Before sending the email, it’s best to store a notification in your database so you can:

  • prevent duplicates
  • show in-app notifications
  • retry email delivery if needed

Example fields:

  • recipient_user_id
  • actor_user_id
  • post_id
  • type: mention
  • read_at
  • created_at

3) Send the email

Use your email provider or mail library to send a notification email.

Email content usually includes:

  • who mentioned them
  • the post/comment content
  • a link to view it
  • an unsubscribe or notification settings link

Example subject:

You were mentioned by John

Example body:

John mentioned you in a comment:

"Hey @alice, can you review this?"

View it here: https://yourapp.com/posts/123

4) Do it asynchronously

Mention emails should usually be sent in a background job/queue rather than during the request, so posting stays fast.

Examples:

  • Sidekiq / Celery / BullMQ / Delayed Job
  • Cron worker or task queue

5) Avoid spam and duplicates

Best practices:

  • Don’t email the same user multiple times for repeated mentions in one post
  • Respect user notification preferences
  • Rate limit emails
  • Don’t send if the user mentioned themselves
  • Consider batching if many mentions happen at once

Minimal implementation outline

Pseudocode

def create_post(author, content):
    post = save_post(author, content)
    usernames = extract_mentions(content)

    for username in set(usernames):
        user = find_user_by_username(username)
        if user and user.wants_mention_emails:
            create_notification(user, post, author)
            queue_email(user.email, post, author)

    return post

If you’re using a specific stack

I can give you exact code for:

  • Ruby on Rails
  • Django
  • Node.js / Express
  • Laravel
  • ASP.NET
  • React + backend
  • SendGrid / Mailgun / SES / SMTP

If you want, tell me your stack and I’ll show a concrete example.

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.