Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix specs for pull request #136 #137

Merged
merged 2 commits into from

3 participants

@scambra

I have fixed specs as required in #136

pedropaG and others added some commits
@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
@scambra scambra fix checking from header in specs 1c7c73d
@ugisozols ugisozols merged commit bda5658 into from
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}>"
Commits on Jan 2, 2014
  1. @scambra
This page is out of date. Refresh to see the latest.
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
View
6 spec/features/refinery/inquiries/mailer_spec.rb
@@ -22,7 +22,8 @@ module Inquiries
it "sends confirmation email" do
open_email("ugis.ozols@refinerycms.com")
- current_email.from.should eq("Ugis Ozols [#{Refinery::Core.site_name}] <#{Refinery::Inquiries.from_name}@example.com>")
+ current_email.header["from"].should eq("Ugis Ozols [#{Refinery::Core.site_name}] <#{Refinery::Inquiries.from_name}@example.com>")
+ current_email.from.should eq(["#{Refinery::Inquiries.from_name}@example.com"])
current_email.to.should eq(["ugis.ozols@refinerycms.com"])
current_email.subject.should eq("Thank you for your inquiry")
current_email.body.should eq("Thank you for your inquiry Ugis Ozols,\n\nThis email is a receipt to confirm we have received your inquiry and we'll be in touch shortly.\n\nThanks.")
@@ -31,7 +32,8 @@ module Inquiries
it "sends notification email" do
open_email("rspec@refinerycms.com")
- current_email.from.should eq("Ugis Ozols [#{Refinery::Core.site_name}] <#{Refinery::Inquiries.from_name}@example.com>")
+ current_email.header["from"].should eq("Ugis Ozols [#{Refinery::Core.site_name}] <#{Refinery::Inquiries.from_name}@example.com>")
+ current_email.from.should eq(["<#{Refinery::Inquiries.from_name}@example.com"])
current_email.to.should eq(["rspec@refinerycms.com"])
current_email.subject.should eq("New inquiry from your website")
current_email.body.should eq("Hi there,\n\nYou just received a new inquiry on your website.\n\n--- inquiry starts ---\n\nFrom: Ugis Ozols\nEmail: ugis.ozols@refinerycms.com\nPhone: \nMessage:\nHey, I'm testing!\n\n--- inquiry ends ---\n\nKind Regards,\nCompany Name\n\nP.S. All your inquiries are stored in the \"Inquiries\" section of Refinery should you ever want to view it later there.")
Something went wrong with that request. Please try again.