Start a New Topic via Email ✉


(Jeff Atwood) #1

If you have already set up reply via email, or you are on a hosting plan that pre-configures your incoming email, you’re now ready to set up Starting a New Topic via Email.

Site Settings

The incoming emails feature is globally controlled by these 3 site settings:

  • email_in: this is the only setting that must be enabled for incoming emails to work.
  • email_in_min_trust: the minimum trust level required for users to send an email to Discourse.
  • enable_staged_users: create staged users for unknown email addresses.

What are staged users?

In order to support incoming emails from anyone, we needed a way to create user accounts on the fly.
Unfortunately, we couldn’t use normal user accounts. They would start receiving digests and it would prevent people from signing up with the same email address (which was confusing since they only sent emails).

That’s why we came up with the idea of staged users. They are special user accounts in Discourse.

They can’t be mentioned or searched for, they will never receive a digest and they can only be notified of and reply to the topics they started or were invited in.

If the user ever wants to create an user account using the same email address, we will promote the staged user to a normal user.

Category vs Group

So now that you have enabled incoming emails, you need to decide whether you want them to end up into a category or a group.

Why use a group?

  • Using a group is useful if you want to set up a support-like workflow.
  • Sending an email to a group will create a message sent to all the members of that group.
  • These messages will appear in /my/messages.
  • Anyone can send an email to a group (since it’s just an email behind the scene)
  • Any member of the group may read, reply, delete or archive the message.
  • All member of the group have their own read tracking state.

Why use a category?

  • Using a category is useful if you want to simulate a mailing list.
  • Sending an email to a category will create a topic in said category.
  • Anyone with access to that category may read and reply using the web interface or via email.
  • Emails sent to a category must respect the category’s security settings.
  • Emails sent to a category must respect the email_in_min_trust_level site setting.
  • You may disable staged users on a per category basis.

Setting up incoming emails on a group

To setup incoming emails on a group, you need to go to /admin/groups/custom and click the name of the group (or create a new one).

At the bottom of the form, there should be a field named Custom incoming email address. If there isn’t, make sure you have enabled the email_in site setting.

Enter the email address you want to associate to that group and click the Save button to save your changes.

You’re done :tada:

Setting up incoming emails on a category

To setup incoming emails on a category, you need to go to the category’s page (eg. /c/<category_slug>) and click the Edit button.

Then, click the Settings tab on the Edit category modal that shows up.

There should be two fields “Accept emails from anonymous users with no accounts” and “Custom incoming email address”. If there aren’t, make sure you have enabled the email_in site setting.

Enable “Accept emails from anonymous users with no accounts” if you want staged users to be created when an incoming email address does not exists yet.

Enter the email address you want to associate to that category and click the Save Category button to save your changes.

You’re done :tada:

For troubleshooting tips, see the Logging and Errors section of this topic.


Understanding email in functionality
Post without signup?
Can I start a new topic by sending an email message?
Good use cases for groups (to better understand groups vs categories)
Registering unregistered users on first email a la mailman?
Can I start a new topic by sending an email message?
[PAID] Auto create new topic when I publish a video on YouTube
When site require approvals for users, email replies do not get sent to staged users
Who is Discobot?
Can I start a new topic by sending an email message?
Can I start a new topic by sending an email message?
Discourse 1.9.0.beta15 Release Notes
How to enable post via email
How to go about hosting a design contest?
(Nick) #2

Custom incoming email FORMAT

Superb #howto . Hard to find this article - maybe because its newish. I ran into some UX / formatting issues that @mpalmer helped me iron out. When filling out the “Custom incoming email address” field, you need to stick with certain email address’s.

I have a site hosted by discourse and I found the formats to be any of the following:

<site_name>@<domain>
<site_name>+whatever@<domain>
whatever@<site_name>.<domain>

(Régis Hanol) #3

What are you calling “<site_name>”?


(Nick) #4

I dont know the right term.
<site_name> = the third-level-domain piece of the URL

ex: myponysite.trydiscourse.com
<site_name> = myponysite


(Thomas S) #5

Do we create a random email at this domain?
Or do we provide the name of the account it would come in from?


(Chris Beach) #6

Have just set this up - absolutely brilliant.

A note to anybody wondering how to configure pop3 polling - see here (a single account is configured for polling, and all “start a new topic via email” accounts need to forward to the polled mailbox).


(Christoph) #8

Trying to understand what this means when staged users are enabled: Am I right in assuming that staged users are exempt from these requirements? In other words: which setting takes precedence: “allow staged user to post to this category” or “don’t allow staged user to post to this category due to security/trust level settings”?

If emails from staged users are not exempt from category security setting, the question is: are they included in “Everyone” in those settings? (Normally “everyone” means “every forum user”, but do staged users count as such?


#11

This is a lifesaver. I have successfully set up a custom email for Category1:

reply+category1@mydomain.com

with reply@mydomain.com being the polled POP3 account. Slick!

Question is: what is the “default” email for starting a topic?
IE, do I have to specify a custom reply+category#@mydomain etc for every category?
Or does discourse accept repy+<category_slug>@mydomain by default?


(Gerhard Schlager) #12

It’s the category’s email address. So, in your case it’s reply+category1@mydomain.com


#13

I’m not having success with ‘default’ using the slug… I have had to add the custom email address to each category: reply+category@mydomain.com

This works, but with more than a few categories, it could be cumbersome. Thanks!


(Gerhard Schlager) #14

Yeah, it doesn’t work without configuring a custom email address for each category.


(TomG) #15

I’ve been playing with this and have some empirical observations:

If the category does not accept anonymous user posting then a staged user can’t create a post even if they meet minimum mail-in trust level, belong to a group (built-in or custom) that has access and have been activated. Before I found this post I had only got this to work by firing up a rails console and “unstaging” the user.

I hadn’t equated anonymous users with staged users.


#16

another way to simplify category email addresses is through setting up a bunch of email forwarders on your email account.

example:
your email account: reply@yourdomain.com
category email: categoryname@yourdomain.com
forwarder: categoryname@yourdomain.com to reply@yourdomain.com

basically, you just need to make sure that whatever email you choose for a category, will end up in your discourse mailbox (reply@yourdomain.com).