Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Handling Message-ID with templates better #4

Merged
merged 1 commit into from Apr 5, 2013

Conversation

Projects
None yet
2 participants
Owner

kerinin commented Apr 5, 2013

Uses the header if it's defined in the template, unless :message_id is
explicitly passed

@kerinin kerinin Handling Message-ID with templates better
Uses the header if it's defined in the template, unless :message_id is
explicitly passed
9a9d7f0

@benhamill benhamill commented on the diff Apr 5, 2013

lib/luggage/message.rb
@@ -24,7 +24,12 @@ def self.new_local(connection, mailbox, args = {}, &block)
args.each do |key, value|
mail[key] = value if mail.respond_to?(key)
end
- mail[:message_id] = message_id
+
+ if mail[:message_id] && !args.has_key?(:message_id)
+ @message_id = mail.message_id
+ else
+ mail[:message_id] = message_id
@benhamill

benhamill Apr 5, 2013

Contributor

Do you also need to set @message_id here, too?

@kerinin

kerinin Apr 5, 2013

Owner

No, message_id is just an attr_reader for the instance variable, and we're setting the header on the Mail object to the instance variable.

@benhamill

benhamill Apr 5, 2013

Contributor

Ah. I see. Isn't that always going to be nil at this point, then, or am I missing how that's set (aside from line 29, of course)?

@kerinin

kerinin Apr 5, 2013

Owner

It gets set to a UUID-based string when the message = new(connection, mailbox, args) gets called (see the initializer).

@benhamill

benhamill Apr 5, 2013

Contributor

Riiiiiiiight. Cool.

Contributor

benhamill commented Apr 5, 2013

👍

@kerinin kerinin added a commit that referenced this pull request Apr 5, 2013

@kerinin kerinin Merge pull request #4 from otherinbox/rm/default_to_template_message_id
Handling Message-ID with templates better
80b57c4

@kerinin kerinin merged commit 80b57c4 into master Apr 5, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment