Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix from header in mail when utf8 characters are used #136

Merged
merged 1 commit into from

2 participants

@pedropaG

When UTF8 characters are used in name or site name, from header is utf8 encoded but quotes are needed or header will be wrong.

Without quotes I get:

=?UTF-8?Q?Pedro_ [Ib=C3=A9rica_de_Sales_S.A.] _ <pedro@example.com>,
    ?=@example.com

With quotes I get:

=?UTF-8?B?cGl0ZXIgW0liw6lyaWNhIGRlIFNhbGVzIFMuQS5d?= <pedro@example.com>

In 2.0 it worked because it was quoted like this:

"\"#{Refinery::Core.site_name}\" <no-reply@#{request.domain}>"
@pedropaG pedropaG Fix from header in mail when utf8 characters are used
When UTF8 characters are used in name or site name, from header is utf8 encoded but quotes are needed or header will be wrong.

Without quotes I get:
=?UTF-8?Q?Pedro_ [Ib=C3=A9rica_de_Sales_S.A.] _ <pedro@programatica.es>,
	?=@programatica.es

With quotes I get:
=?UTF-8?B?cGl0ZXIgW0liw6lyaWNhIGRlIFNhbGVzIFMuQS5d?= <pedro@programatica.es>

In 2.0 it worked because it was quoted like this:
"\"#{Refinery::Core.site_name}\" <no-reply@#{request.domain}>"
cceae6f
@ugisozols ugisozols merged commit da49bf8 into from
@ugisozols ugisozols referenced this pull request from a commit
@ugisozols ugisozols Wrap from_name in quotes as per #136.
Also make from_* methods private because we don’t want these to be
“deliverable”.
4c2a7e5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 27, 2013
  1. @pedropaG

    Fix from header in mail when utf8 characters are used

    pedropaG authored
    When UTF8 characters are used in name or site name, from header is utf8 encoded but quotes are needed or header will be wrong.
    
    Without quotes I get:
    =?UTF-8?Q?Pedro_ [Ib=C3=A9rica_de_Sales_S.A.] _ <pedro@programatica.es>,
    	?=@programatica.es
    
    With quotes I get:
    =?UTF-8?B?cGl0ZXIgW0liw6lyaWNhIGRlIFNhbGVzIFMuQS5d?= <pedro@programatica.es>
    
    In 2.0 it worked because it was quoted like this:
    "\"#{Refinery::Core.site_name}\" <no-reply@#{request.domain}>"
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 4 deletions.
  1. +4 −4 app/mailers/refinery/inquiries/inquiry_mailer.rb
View
8 app/mailers/refinery/inquiries/inquiry_mailer.rb
@@ -6,10 +6,10 @@ def confirmation(inquiry, request)
@inquiry = inquiry
mail :subject => Refinery::Inquiries::Setting.confirmation_subject(Globalize.locale),
:to => inquiry.email,
- :from => ::I18n.t('from_name',
+ :from => '"' + ::I18n.t('from_name',
:scope => 'refinery.inquiries.config',
:site_name => Refinery::Core.site_name,
- :name => @inquiry.name) + " <#{Refinery::Inquiries.from_name}@#{request.domain}>",
+ :name => @inquiry.name) + "\" <#{Refinery::Inquiries.from_name}@#{request.domain}>",
:reply_to => Refinery::Inquiries::Setting.notification_recipients.split(',').first
end
@@ -17,10 +17,10 @@ def notification(inquiry, request)
@inquiry = inquiry
mail :subject => Refinery::Inquiries::Setting.notification_subject,
:to => Refinery::Inquiries::Setting.notification_recipients,
- :from => ::I18n.t('from_name',
+ :from => '"' + ::I18n.t('from_name',
:scope => 'refinery.inquiries.config',
:site_name => Refinery::Core.site_name,
- :name => @inquiry.name) + " <#{Refinery::Inquiries.from_name}@#{request.domain}>",
+ :name => @inquiry.name) + "\" <#{Refinery::Inquiries.from_name}@#{request.domain}>",
:reply_to => inquiry.email
end
Something went wrong with that request. Please try again.