# 'title' being used in digest

**URL:** https://meta.discourse.org/t/title-being-used-in-digest/16943
**Category:** Feature
**Tags:** activity-summary
**Created:** [28. Juni 2014 um 07:36 UTC](https://meta.discourse.org/t/title-being-used-in-digest/16943 "2014-06-28T07:36:30Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![michaeld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/michaeld/32/1594_2.png) [@michaeld](https://meta.discourse.org/u/michaeld)
#### Post date: [28. Juni 2014 um 07:36 UTC](https://meta.discourse.org/t/title-being-used-in-digest/16943/1 "2014-06-28T07:36:31Z")

</div>

`lib/email/message_builder.rb` uses the forum’s `SiteSetting` `title` as the email sender.

```
def site_alias_email(source)
  "#{SiteSetting.title} <#{source}>"
end

```

We have some customers using characters in the title that are not allowed per RFC2821/RFC2822, causing the email to be rejected by Mandrill.

Also, some users use ‘Welcome to XYZ community’ as a forum title, causing email digests to be sent out with the sender ‘Welcome to XYZ community digest’, where ‘XYZ community digest’ would make more sense.

How about making a separate site setting for the `title` when used as an email sender in conjunction with `notification_email` ?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [28. Juni 2014 um 17:29 UTC](https://meta.discourse.org/t/title-being-used-in-digest/16943/2 "2014-06-28T17:29:48Z")

</div>

Doesn’t this alternate email site name setting already exist?

---

<div class="post-metadata">

### Author: ![michaeld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/michaeld/32/1594_2.png) [@michaeld](https://meta.discourse.org/u/michaeld)
#### Post date: [28. Juni 2014 um 19:54 UTC](https://meta.discourse.org/t/title-being-used-in-digest/16943/3 "2014-06-28T19:54:37Z")

</div>

I can’t find it. There’s `email_prefix` which is used for the subject line, and that overrides `title` indeed. But that’s not used for the sender.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [29. Juni 2014 um 09:26 UTC](https://meta.discourse.org/t/title-being-used-in-digest/16943/4 "2014-06-29T09:26:48Z")

</div>

I see. @neil can you add this to your list? If users can enter crazy characters, they will. Not sure what the best course of action here is, but broken emails will lead to support topics, and support topics lead to hair loss.

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [9. Juli 2014 um 20:47 UTC](https://meta.discourse.org/t/title-being-used-in-digest/16943/5 "2014-07-09T20:47:59Z")

</div>

I added a new setting called `email site title` to override the `SiteSetting.title` in this case. When left blank, `title` will be used (as it is today).

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [9. Juli 2014 um 21:11 UTC](https://meta.discourse.org/t/title-being-used-in-digest/16943/6 "2014-07-09T21:11:04Z")

</div>

@michaeld we’re a little unclear what you mean by the RFC characters in email titles. Can you provide an example?

---

<div class="post-metadata">

### Author: ![michaeld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/michaeld/32/1594_2.png) [@michaeld](https://meta.discourse.org/u/michaeld)
#### Post date: [9. Juli 2014 um 23:16 UTC](https://meta.discourse.org/t/title-being-used-in-digest/16943/7 "2014-07-09T23:16:52Z")

</div>

We saw this a few times, I documented one of them. It happened with a forum title that

- had 88 characters
- a question mark
- a comma
- an exclamation mark

This made Mandrill choke on emails with a “bad sender address syntax” error message.

Changing the title into something shorter and without !?, solved the issue. So it must be one of those that caused it.

By the way, I found [this topic](https://meta.discourse.org/t/mandrillapp-smtp-401-4-1-7-bad-sender-address-syntax-in-digest-mails/15975) as well - _whoops, should have spotted that two weeks ago_ - in that case a colon was the problem.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [9. Juli 2014 um 23:24 UTC](https://meta.discourse.org/t/title-being-used-in-digest/16943/8 "2014-07-09T23:24:03Z")

</div>

OK so in this case @neil it is the Reply-To field that is a problem _not_ the title, e.g.

`Reply-To: Norton Imperial Labs : Discussion digest <ry@n.rix.si>`

So when constructing that Reply-To in that particular place, let’s just strip all non letter (unicode included) or number chars.

---

<div class="post-metadata">

### Author: ![michaeld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/michaeld/32/1594_2.png) [@michaeld](https://meta.discourse.org/u/michaeld)
#### Post date: [10. Juli 2014 um 06:50 UTC](https://meta.discourse.org/t/title-being-used-in-digest/16943/9 "2014-07-10T06:50:59Z")

</div>

The `title` is used both in From: and Reply-To:

After a night of sleep, I’m more and more convinced that the length might have been the actual issue.

---

<div class="post-metadata">

### Author: ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)
#### Post date: [8. August 2014 um 19:33 UTC](https://meta.discourse.org/t/title-being-used-in-digest/16943/10 "2014-08-08T19:33:56Z")

</div>

> [@codinghorror](#):
>
> So when constructing that Reply-To in that particular place, let’s just strip all non letter (unicode included) or number chars.

Quoting the string there should take care of it - the `:` has a special meaning which is conflicting:

```plaintext
rcpt to:Neil: The Best <neil@asdf.com> 
553 5.1.3 Neil:... List:; syntax illegal for recipient addresses
rcpt to:"Neil: The Best <neil@asdf.com>"
250 2.1.5 "Neil: The Best <neil@asdf.com>"... Recipient ok

```

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [8. August 2014 um 19:37 UTC](https://meta.discourse.org/t/title-being-used-in-digest/16943/11 "2014-08-08T19:37:06Z")

</div>

Oh I see so maybe the better fix @neil is to just put double quotes there.

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [11. August 2014 um 19:49 UTC](https://meta.discourse.org/t/title-being-used-in-digest/16943/12 "2014-08-11T19:49:55Z")

</div>

I get “Bad sender address syntax” for all email addresses when I do that (using Mandril smtp)…

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [19. Dezember 2014 um 23:31 UTC](https://meta.discourse.org/t/title-being-used-in-digest/16943/13 "2014-12-19T23:31:22Z")

</div>

Did we resolve this in the last round of email changes @techapj?

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [20. Dezember 2014 um 14:53 UTC](https://meta.discourse.org/t/title-being-used-in-digest/16943/14 "2014-12-20T14:53:04Z")

</div>

Yes, this issue is fixed now.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [20. Dezember 2014 um 20:40 UTC](https://meta.discourse.org/t/title-being-used-in-digest/16943/15 "2014-12-20T20:40:46Z")

</div>


