'title' being used in digest


(Michael - DiscourseHosting.com) #1

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 ?


Sidekiq leaking information across multisite
(Jeff Atwood) #2

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


(Michael - DiscourseHosting.com) #3

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.


(Jeff Atwood) #4

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.


(Neil Lalonde) #5

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


(Jeff Atwood) #6

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


(Michael - DiscourseHosting.com) #7

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.


(Jeff Atwood) #8

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.


(Michael - DiscourseHosting.com) #9

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.


(Michael Brown) #10

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

(Jeff Atwood) #11

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


(Neil Lalonde) #12

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


(Jeff Atwood) #13

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


(Arpit Jalan) #14

Yes, this issue is fixed now.


(Jeff Atwood) #15