forked from tablecheck/mail-ses
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support SES options via mail message headers
This makes it possible to set new options (like `email_tags`) for each individual email message.
- Loading branch information
1 parent
6cc0f32
commit b59053d
Showing
2 changed files
with
48 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,6 +102,42 @@ | |
it { expect(subject).to eq(exp) } | ||
end | ||
|
||
context "with options on the mail object" do | ||
let(:mail) do | ||
Mail.new do | ||
from '"My From" <[email protected]>' | ||
reply_to ["[email protected]", "", "My Reply-To <[email protected]>"] | ||
to ["[email protected]", "My To <[email protected]>", ""] | ||
cc ["", "[email protected]", "My CC <[email protected]>"] | ||
bcc ["My BCC <[email protected]>", "", "[email protected]"] | ||
body "This is the body" | ||
headers(mail_options: {email_tags: [{name: "Foo", value: "Bar"}]}) | ||
end | ||
end | ||
|
||
let(:exp) do | ||
{ | ||
from_email_address: "My From <[email protected]>", | ||
reply_to_addresses: ["[email protected]", "My Reply-To <[email protected]>"], | ||
destination: { | ||
to_addresses: ["[email protected]", "My To <[email protected]>"], | ||
cc_addresses: ["[email protected]", "My CC <[email protected]>"], | ||
bcc_addresses: ["My BCC <[email protected]>", "[email protected]"] | ||
}, | ||
email_tags: [ | ||
{name: "Foo", value: "Bar"} | ||
], | ||
content: { | ||
raw: { | ||
data: "Fixed message body" | ||
} | ||
} | ||
} | ||
end | ||
|
||
it { expect(subject).to eq(exp) } | ||
end | ||
|
||
context "when addresses contain non-ascii chars" do | ||
let(:mail) do | ||
Mail.new do | ||
|