'title' being used in digest

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

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

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 ?

1 Like

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

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.

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.

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).


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

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 as well - whoops, should have spotted that two weeks ago - in that case a colon was the problem.

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.

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.

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

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

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

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

1 Like

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

Yes, this issue is fixed now.