Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Allow users to configure From name. #111

Merged
merged 1 commit into from

2 participants

@ugisozols
Owner

Closes #82.

@parndt parndt commented on the diff
spec/requests/refinery/inquiries/mailer_spec.rb
@@ -22,7 +22,7 @@ module Inquiries
it "sends confirmation email" do
open_email("ugis.ozols@refinerycms.com")
- current_email.from.should eq(["no-reply@example.com"])
+ current_email.from.should eq("Ugis Ozols [#{Refinery::Core.site_name}] <no-reply@example.com>")
@parndt Owner
parndt added a note

Your name looks so strange with just plain characters :smile:

@ugisozols Owner

:smile:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@parndt parndt merged commit eb5b93a into from
@parndt parndt deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 25, 2013
  1. @ugisozols

    Allow users to configure From name.

    ugisozols authored
    Closes #82.
This page is out of date. Refresh to see the latest.
View
10 app/mailers/refinery/inquiries/inquiry_mailer.rb
@@ -6,7 +6,10 @@ def confirmation(inquiry, request)
@inquiry = inquiry
mail :subject => Refinery::Inquiries::Setting.confirmation_subject(Globalize.locale),
:to => inquiry.email,
- :from => "\"#{Refinery::Core.site_name}\" <no-reply@#{request.domain}>",
+ :from => ::I18n.t('from_name',
+ :scope => 'refinery.inquiries.config',
+ :site_name => Refinery::Core.site_name,
+ :name => @inquiry.name) + " <no-reply@#{request.domain}>",
:reply_to => Refinery::Inquiries::Setting.notification_recipients.split(',').first
end
@@ -14,7 +17,10 @@ def notification(inquiry, request)
@inquiry = inquiry
mail :subject => Refinery::Inquiries::Setting.notification_subject,
:to => Refinery::Inquiries::Setting.notification_recipients,
- :from => "\"#{Refinery::Core.site_name}\" <no-reply@#{request.domain}>",
+ :from => ::I18n.t('from_name',
+ :scope => 'refinery.inquiries.config',
+ :site_name => Refinery::Core.site_name,
+ :name => @inquiry.name) + " <no-reply@#{request.domain}>",
:reply_to => inquiry.email
end
View
2  config/locales/en.yml
@@ -5,6 +5,8 @@ en:
title: Inquiries
description: Provides a contact form and stores inquiries
inquiries:
+ config:
+ from_name: "%{name} [%{site_name}]"
inquiries:
new:
send: Send message
View
4 spec/requests/refinery/inquiries/mailer_spec.rb
@@ -22,7 +22,7 @@ module Inquiries
it "sends confirmation email" do
open_email("ugis.ozols@refinerycms.com")
- current_email.from.should eq(["no-reply@example.com"])
+ current_email.from.should eq("Ugis Ozols [#{Refinery::Core.site_name}] <no-reply@example.com>")
@parndt Owner
parndt added a note

Your name looks so strange with just plain characters :smile:

@ugisozols Owner

:smile:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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,\r\n\r\nThis email is a receipt to confirm we have received your inquiry and we'll be in touch shortly.\r\n\r\nThanks.")
@@ -31,7 +31,7 @@ module Inquiries
it "sends notification email" do
open_email("rspec@refinerycms.com")
- current_email.from.should eq(["no-reply@example.com"])
+ current_email.from.should eq("Ugis Ozols [#{Refinery::Core.site_name}] <no-reply@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,\r\n\r\nYou just received a new inquiry on your website.\r\n\r\n--- inquiry starts ---\r\n\r\nFrom: Ugis Ozols\r\nEmail: ugis.ozols@refinerycms.com\r\nPhone: \r\nMessage:\r\nHey, I'm testing!\r\n\r\n--- inquiry ends ---\r\n\r\nKind Regards,\r\nCompany Name\r\n\r\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.