Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mail attempts to decode a mail message twice when using exim #814

Closed
dukha opened this issue Oct 15, 2014 · 4 comments
Closed

Mail attempts to decode a mail message twice when using exim #814

dukha opened this issue Oct 15, 2014 · 4 comments

Comments

@dukha
Copy link

dukha commented Oct 15, 2014

When trying the basic example in the readme with exim, I only received and error:

NoMethodError: undefined method encoded' for #String:0x0000000947f9d8 from /home/mark/.rvm/gems/ruby-2.0.0-p247/gems/mail 2.5.4/lib/mail/network/delivery_methods/exim.rb:46:inblock in call'

The mail message should have been an instance of the Mail class which respond to 'encoded', not a string.

It turns out the encoded is being called twice, once in the super class(Mail::Sendmail) and once in the subclass Mail::Exim.

My fix was to remove encoded from the Mail:Exim

def self.call(path, arguments, destinations, encoded_mail)
   popen "#{path} #{arguments}" do |io|
  io.puts encoded_mail.to_lf
  io.flush
   end
 end

This research was done in 2.5.4, however it looks like it is still in the master on github.

@bf4
Copy link
Collaborator

bf4 commented Jan 15, 2015

Thanks for this. Are you able to write a test that demonstrates this behavior?

@dukha
Copy link
Author

dukha commented Jan 15, 2015

Hi Ben
I could but I have time pressure right now. How much time to I have.

Regards

Mark

On 15 January 2015 at 14:14, Benjamin Fleischer notifications@github.com
wrote:

Thanks for this. Are you able to write a test that demonstrates this
behavior?


Reply to this email directly or view it on GitHub
#814 (comment).

@cheenwe
Copy link

cheenwe commented Oct 9, 2016

same question

/root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/mail-2.6.4/lib/mail/network/delivery_methods/exim.rb:47:in `block in call': undefined method `encoded' for #<String:0x007f8fd34eec28> (NoMethodError)
        from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/mail-2.6.4/lib/mail/network/delivery_methods/sendmail.rb:73:in `popen'
        from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/mail-2.6.4/lib/mail/network/delivery_methods/sendmail.rb:73:in `popen'
        from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/mail-2.6.4/lib/mail/network/delivery_methods/exim.rb:46:in `call'
        from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/mail-2.6.4/lib/mail/network/delivery_methods/sendmail.rb:57:in `deliver!'
        from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/mail-2.6.4/lib/mail/message.rb:253:in `deliver!'
        from email.rb:17:in `<main>'

@jeremy
Copy link
Collaborator

jeremy commented May 22, 2017

Fixed by 67ac9bb, backport of #689.

@jeremy jeremy closed this as completed May 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants