Hi, i am trying to send an email using RoR version 2.1.0 but i get
some errors. I have this configuration:
1- In config/eviroment.rb, at the very end of my file:
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:address => "smtp.domain.com",
:port => 25,
:domain => "domain.com",
:authentication => :login,
:user_name => "user-9IKiO1iGCm/QT0dZR+AlfA@public.gmane.org",
:password => "secret"
}
ActionMailer::Base.default_content_type = "text/html"
ActionMailer::Base.raise_delivery_errors = true
2- app/models/Emailer i have:
class Emailer < ActionMailer::Base
def contact_email(email_params, sent_at = Time.now)
@recipients =
"someuser-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org"
@from = email_params[:name] + " <" + email_params[:address]
+
">"
@subject = email_params[:subject]
@sent_on = sent_at
@body["email_body"] = email_params[:body]
@body["email_name"] = email_params[:name]
end
end
3- app/controllers/contact_controller i have:
class ContactController < ApplicationController
def index
end
def send_mail
Emailer::deliver_contact_email(params[:email])
end
end
4- app/views/emailer/contact_email.rhtml i have:
Name:
<%= @email_name %>
Message:
<%= @email_body %>
5- in app/view/contact/index.html.erb have:
<% form_tag ''/contact/send_mail'' do %>
<table>
<tr>
<td><label
for="email_name">Name:</label></td>
<td><%= text_field "email", "name", :size
=> 30 %></td>
</tr>
<tr>
<td><label for="email_address">Email
Address:</label></td>
<td><%= text_field "email", "address",
:size => 30 %></td>
</tr>
<tr>
<td><label
for="email_subject">Subject:</label></td>
<td><%= text_field "email", "subject",
:size => 30 %></td>
</tr>
<tr>
<td><label
for="email_body">Body:</label></td>
<td><%= text_area "email", "body", :rows
=> 8, :cols => 30 %></
td>
</tr>
</table>
<%= submit_tag ''Send Email'' %>
<% end -%>
5- Errors i got:
Net::SMTPSyntaxError (502 unimplemented (#5.5.1)
):
/usr/lib/ruby/1.8/net/smtp.rb:948:in `check_auth_continue''
/usr/lib/ruby/1.8/net/smtp.rb:740:in `auth_login''
/usr/lib/ruby/1.8/net/smtp.rb:921:in `critical''
....
....
....
I have read a lot in different forums about the same problema but no
solution found. I also asked to my hosting solution about smtp
configuration, and they said that i am using the correct information
about our smtp. So I do not have any idea of what i am doing wrong,
need help please. Any idea?
Cheers
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
On Sep 13, 10:25 am, fRAnKEnSTEin <shirkav...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, i am trying to send an email using RoR version 2.1.0 but i get > some errors. I have this configuration: > > 1- In config/eviroment.rb, at the very end of my file: > > ActionMailer::Base.delivery_method = :smtp > > ActionMailer::Base.smtp_settings = { > :address => "smtp.domain.com", > :port => 25, > :domain => "domain.com", > :authentication => :login, > :user_name => "u...-9IKiO1iGCm/QT0dZR+AlfA@public.gmane.org", > :password => "secret" > > } >Sounds like the mail server doesn''t support the :login authentication method (Have you tried the other options ?(:plain, :cram_md5)). Perhaps the server requires no authentication in which case you should just remove the :authentication option. Fred --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
fRAnKEnSTEin wrote:> Hi, i am trying to send an email using RoR version 2.1.0 but i get > some errors. I have this configuration: > > 1- In config/eviroment.rb, at the very end of my file: > > ActionMailer::Base.delivery_method = :smtp > > ActionMailer::Base.smtp_settings = { > :address => "smtp.domain.com", > :port => 25, > :domain => "domain.com", > :authentication => :login, > :user_name => "user-9IKiO1iGCm/QT0dZR+AlfA@public.gmane.org", > :password => "secret" > } > > ActionMailer::Base.default_content_type = "text/html" > ActionMailer::Base.raise_delivery_errors = true > > 2- app/models/Emailer i have: > > class Emailer < ActionMailer::Base > def contact_email(email_params, sent_at = Time.now) > @recipients = "someuser-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" > @from = email_params[:name] + " <" + email_params[:address] + > ">" > @subject = email_params[:subject] > @sent_on = sent_at > @body["email_body"] = email_params[:body] > @body["email_name"] = email_params[:name] > end > end > > 3- app/controllers/contact_controller i have: > > class ContactController < ApplicationController > def index > end > > def send_mail > Emailer::deliver_contact_email(params[:email]) > end > > end > > 4- app/views/emailer/contact_email.rhtml i have: > Name: > > <%= @email_name %> > > Message: > > <%= @email_body %> > > 5- in app/view/contact/index.html.erb have: > <% form_tag ''/contact/send_mail'' do %> > <table> > <tr> > <td><label for="email_name">Name:</label></td> > <td><%= text_field "email", "name", :size => 30 %></td> > </tr> > <tr> > <td><label for="email_address">Email Address:</label></td> > <td><%= text_field "email", "address", :size => 30 %></td> > </tr> > <tr> > <td><label for="email_subject">Subject:</label></td> > <td><%= text_field "email", "subject", :size => 30 %></td> > </tr> > <tr> > <td><label for="email_body">Body:</label></td> > <td><%= text_area "email", "body", :rows => 8, :cols => 30 %></ > td> > </tr> > </table> > > <%= submit_tag ''Send Email'' %> > > <% end -%> > > 5- Errors i got: > > Net::SMTPSyntaxError (502 unimplemented (#5.5.1) > ): > /usr/lib/ruby/1.8/net/smtp.rb:948:in `check_auth_continue'' > /usr/lib/ruby/1.8/net/smtp.rb:740:in `auth_login'' > /usr/lib/ruby/1.8/net/smtp.rb:921:in `critical'' > .... > .... > .... > > I have read a lot in different forums about the same problema but no > solution found. I also asked to my hosting solution about smtp > configuration, and they said that i am using the correct information > about our smtp. So I do not have any idea of what i am doing wrong, > need help please. Any idea? > > CheersYou may try telnet''ing in to port 25 of your smtp server and issuing the EHLO (or HELO) command and verify that one of the auth types supported is LOGIN. Are you certain your server requires authentication to send email? Cheers, Darrik -- Darrik Mazey DMT Programming, LLC. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi,
Thank you for your fast response. Ok i fixed the issue. The problema
was that i was using smtp as a backend in the instruction:
ActionMailer::Base.delivery_method = :smtp
Our server uses sendmail, i just changed to this:
ActionMailer::Base.delivery_method = :sendmail
and it works perfectly. :-]
But i got now another little problem(i am a noob in RoR) the app send
an error like:
ActionView::MissingTemplate (Missing template contact/
send_mail.html.erb in view path /home/lumenap/public_html/contact/app/
views):
...
...
...
The error is totally correct, because in my app/controllers/
contact_controller i have:
class ContactController < ApplicationController
def index
end
def send_mail
Emailer::deliver_contact_email(params[:email])
end
end
As you see i am not rendering any iew, so if i want to render se same
page that i am workin with(the index) what i shuold put? I puted an
render :text => "somthing" just for testing but it does not work,
gave
me the same error. How can i render the index page?
Regards,
shirkavand
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Hi,
Ok i fixed that too. I just add in my controller action an redirection
to an action, like so:
class ContactController < ApplicationController
def index
end
def send_mail
Emailer::deliver_contact_email(params[:email])
redirect_to :action => ''index''
end
end
That works great, now everything works perfectly :).
Thank you very much for your support. Have a nice day
Shirkavand
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---