Question

I am having a similar problem. I am using the sendmail option and continue to get the error

"An SMTP From address is required to send a message. Set the message smtp_envelope_from, return_path, sender, or from address."

I have tested the Mail gem from the ruby console and it works perfect. AppConfig reports that delivery method is sendmail and also reports that sender_address is exactly as entered in the app/config/diaspora.yaml file. Mail.delivery_method also returns sendmail. When I set @smtp_envelope_from = 'myemail@example.com' in gems/mail-2.5.4/lib/mail/message.rb I get a similar yet different error message..

"An SMTP To address is required to send a message. Set the message smtp_envelope_to, to, cc, or bcc address."

this error comes up in lib/mail/check_delivery_params.rb:9:in check_delivery_params', I thus attempt to set the @smtp_envelope_to = 'myrecipient@example.com' in message.rb, just to test this as I know these settings should be applied somewhere else (this thread seems to be the only I can find addressing this) the error I receive after setting the @smtp_envelope_to is

undefined methodmap' for "myrecipient@example.com":String

I was originally concerned that the delivery_method wasn't being set right but the trace shows that before check_delivery_params is called I enter lib/mail/network/delivery_methods/sendmail.rb:50:indeliver!' so that is not the case. This is a standard install cloned a week or so ago. Using RVM and ruby-1.9.3-p484. I get the same errors in production mode and development mode. I am using strategies like grep -r method signature to help me find files and attributes where they are being set and initialized. I am having trouble understanding how configurate sets the values in AppConfig and exactly how Devise::Mailer works.

My greatest inquisition in all of this is where in the diaspora application do I call the methods to set smtp_envelope_from and smtp_envelope_to, what is the standard way of setting these in diaspora, and how do I confirm they are set. I am trying to acquire a succesfull mail for password_instructions. It seems this is left up to devise to handle.

Please help as I have been hunting around for the solution for some time. I am not ready to give up on sendmail as that is not necessarily the problem. Also in the version I am working with config/initializers/devise.rb does not have the attributes mentioned previously, they seem to be automatically set somehow, this however good for separating data from logic is actually a little annoying when it doesn't seem to be working.

Further: research I issue the following commands to see where the attributes in question are set and it does not return a single file where they are set to the values I would expect them to be, they are initialized thats it.

~$ grep -r smtp_envelope_from

.irb-history:Mail.smtp_envelope_from

.rvm/gems/ruby-1.9.3-p484@diaspora/gems/mail-2.5.4/lib/mail/check_delivery_params.rb: if mail.smtp_envelope_from.blank?

.rvm/gems/ruby-1.9.3-p484@diaspora/gems/mail-2.5.4/lib/mail/check_delivery_params.rb: raise ArgumentError.new('An SMTP From address is required to send a message. Set the message smtp_envelope_from, return_path, sender, or from address.')

.rvm/gems/ruby-1.9.3-p484@diaspora/gems/mail-2.5.4/lib/mail/check_delivery_params.rb: [mail.smtp_envelope_from, mail.smtp_envelope_to, message]

.rvm/gems/ruby-1.9.3-p484@diaspora/gems/mail-2.5.4/lib/mail/message.rb: @smtp_envelope_from = nil

.rvm/gems/ruby-1.9.3-p484@diaspora/gems/mail-2.5.4/lib/mail/message.rb: # mail.smtp_envelope_from = 'Mikel '

.rvm/gems/ruby-1.9.3-p484@diaspora/gems/mail-2.5.4/lib/mail/message.rb: # mail.smtp_envelope_from #=> 'mikel@test.lindsaar.net'

.rvm/gems/ruby-1.9.3-p484@diaspora/gems/mail-2.5.4/lib/mail/message.rb: # mail.smtp_envelope_from 'Mikel '

.rvm/gems/ruby-1.9.3-p484@diaspora/gems/mail-2.5.4/lib/mail/message.rb: # mail.smtp_envelope_from #=> 'mikel@test.lindsaar.net'

.rvm/gems/ruby-1.9.3-p484@diaspora/gems/mail-2.5.4/lib/mail/message.rb: def smtp_envelope_from( val = nil )

.rvm/gems/ruby-1.9.3-p484@diaspora/gems/mail-2.5.4/lib/mail/message.rb: self.smtp_envelope_from = val

.rvm/gems/ruby-1.9.3-p484@diaspora/gems/mail-2.5.4/lib/mail/message.rb: @smtp_envelope_from || return_path || sender || from_addrs.first

.rvm/gems/ruby-1.9.3-p484@diaspora/gems/mail-2.5.4/lib/mail/message.rb: # mail.smtp_envelope_from = 'Mikel '

.rvm/gems/ruby-1.9.3-p484@diaspora/gems/mail-2.5.4/lib/mail/message.rb: # mail.smtp_envelope_from #=> 'mikel@test.lindsaar.net'

.rvm/gems/ruby-1.9.3-p484@diaspora/gems/mail-2.5.4/lib/mail/message.rb: def smtp_envelope_from=( val )

.rvm/gems/ruby-1.9.3-p484@diaspora/gems/mail-2.5.4/lib/mail/message.rb: @smtp_envelope_from = val

The other command I run to see what I can find

~$ grep -r smtp_envelope_to

.rvm/gems/ruby-1.9.3-p484@diaspora/gems/mail-2.5.4/lib/mail/check_delivery_params.rb: if mail.smtp_envelope_to.blank?

.rvm/gems/ruby-1.9.3-p484@diaspora/gems/mail-2.5.4/lib/mail/check_delivery_params.rb: raise ArgumentError.new('An SMTP To address is required to send a message. Set the message smtp_envelope_to, to, cc, or bcc address.')

.rvm/gems/ruby-1.9.3-p484@diaspora/gems/mail-2.5.4/lib/mail/check_delivery_params.rb: [mail.smtp_envelope_from, mail.smtp_envelope_to, message]

.rvm/gems/ruby-1.9.3-p484@diaspora/gems/mail-2.5.4/lib/mail/message.rb: @smtp_envelope_to = nil

.rvm/gems/ruby-1.9.3-p484@diaspora/gems/mail-2.5.4/lib/mail/message.rb: # mail.smtp_envelope_to = 'Mikel '

.rvm/gems/ruby-1.9.3-p484@diaspora/gems/mail-2.5.4/lib/mail/message.rb: # mail.smtp_envelope_to #=> 'mikel@test.lindsaar.net'

.rvm/gems/ruby-1.9.3-p484@diaspora/gems/mail-2.5.4/lib/mail/message.rb: # mail.smtp_envelope_to ['Mikel ', 'Lindsaar ']

.rvm/gems/ruby-1.9.3-p484@diaspora/gems/mail-2.5.4/lib/mail/message.rb: # mail.smtp_envelope_to #=> ['mikel@test.lindsaar.net', 'lindsaar@test.lindsaar.net']

.rvm/gems/ruby-1.9.3-p484@diaspora/gems/mail-2.5.4/lib/mail/message.rb: def smtp_envelope_to( val = nil )

.rvm/gems/ruby-1.9.3-p484@diaspora/gems/mail-2.5.4/lib/mail/message.rb: self.smtp_envelope_to = val

.rvm/gems/ruby-1.9.3-p484@diaspora/gems/mail-2.5.4/lib/mail/message.rb: @smtp_envelope_to || destinations

.rvm/gems/ruby-1.9.3-p484@diaspora/gems/mail-2.5.4/lib/mail/message.rb: # mail.smtp_envelope_to = 'Mikel '

.rvm/gems/ruby-1.9.3-p484@diaspora/gems/mail-2.5.4/lib/mail/message.rb: # mail.smtp_envelope_to #=> 'mikel@test.lindsaar.net'

.rvm/gems/ruby-1.9.3-p484@diaspora/gems/mail-2.5.4/lib/mail/message.rb: # mail.smtp_envelope_to = ['Mikel ', 'Lindsaar ']

.rvm/gems/ruby-1.9.3-p484@diaspora/gems/mail-2.5.4/lib/mail/message.rb: # mail.smtp_envelope_to #=> ['mikel@test.lindsaar.net', 'lindsaar@test.lindsaar.net'] .rvm/gems/ruby-1.9.3-p484@diaspora/gems/mail-2.5.4/lib/mail/message.rb: def smtp_envelope_to=( val )

.rvm/gems/ruby-1.9.3-p484@diaspora/gems/mail-2.5.4/lib/mail/message.rb: @smtp_envelope_to =

grep: aquota.user: Permission denied

diaspora/log/development.log:ArgumentError (An SMTP To address is required to send a message. Set the message smtp_envelope_to, to, cc, or bcc address.):

diaspora/log/development.log:ArgumentError (An SMTP To address is required to send a message. Set the message smtp_envelope_to, to, cc, or bcc address.):

grep: lost+found: Permission denied

As you can see these settings are initialized in mail/lib/mail/message.rb but are not given appropriate values anywhere else. Is it possible the methods could have an alias name or be set somehow that I could not find them using this technique? Is it possible the actionmailer and mail in ruby-1.9.3-p848 have newer requirements or changes that diaspora doesn't support? (the installation wiki says specifically to use this version.) The config/diaspora.yaml allows me to specify the default from address but the to address should be set in the mail block if I am not mistaken

Still at a loss on this please help

Yet further testing in response to error

undefined methodmap' for "myrecipient@example.com":String

lib/mail/check_delivery_params.rb:9:in check_delivery_params' was expecting an array so I set @smptp_envelope_to = ['myreciepient@example.com'] in gems/mail-2.5.4/lib/mail/message.rb and the email was a success when requesting the password_reset_instructions, but the content in the email was empty. Now considering a problem somewhere in ~/diaspora/app/mailers/diaspora_devise_mailer.rb or ~/.rvm/gems/ruby-1.9.3-p484@diaspora/gems/devise-3.0.2/app/mailers/devise/mailer.rb when I cat the last mentioned file I get

> class Devise::Mailer < Devise.parent_mailer.constantize
>>  include Devise::Mailers::Helpers
>>
>>  def confirmation_instructions(record, opts={})
>>>    devise_mail(record, :confirmation_instructions, opts)
>>  end

>>  def reset_password_instructions(record, opts={})
>>>    devise_mail(record, :reset_password_instructions, opts)
>>  end

>>  def unlock_instructions(record, opts={})
>>>    devise_mail(record, :unlock_instructions, opts)
>>  end
> end

I am now working my way through the controllers in the devise/app at this point I believe the problem is with devise. Hashing over the howto's on mailers in ruby should help me locate this problem. A message block must be created somewhere but it's location is not obvious. If anyone can point me to the right place to create the message block I will do a small victory dance or not.

I also want to note the only entry in ~/diaspora/config/routes.rb relating to this is

>  # This is a hack to overide a route created by devise.
>  # I couldn't find anything in devise to skip that route, see Bug #961
>  match 'users/edit' => redirect('/user/edit')
>
>  devise_for :users, :controllers => {:registrations => "registrations",
>                                      :password      => "devise/passwords",
>                                      :sessions      => "sessions"}

I am curious if I shouldn't take a look at this bug in diaspora

This has been magically fixed by cloning diaspora from github again. It was a newer version that also required a newer version of ruby. Went through the standard process and everything works. Thank you for looking at this. I am still going to keep digging, see whats different and stuff

Was it helpful?

Solution

This was resolved by cloning an updated version of diaspora. The issue appeared to be that a newer version of Devise::Mailer broke diaspora.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top