Question

Hi I followed this railcast to develop posibility to send message from our site to our company specified email.

When I write message and click send it shows no error messages. And inside log file I can see this. When I was in production mode It worked just great. But now it stucked in the air somewhere.

My Rails app log file :

Sent mail to mailer@ecotechno.lv (8ms)
Date: Thu, 13 Feb 2014 05:16:57 -0700
To: mailer@ecotechno.lv
Message-ID: <52fcb7b922872_5a0a37b07c53851@just107.justhost.com.mail>
Subject: Welcome email
Mime-Version: 1.0
Content-Type: text/html;
 charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE html>
<html>
  <head>
    <meta content=3D'text/html; charset=3DUTF-8' http-equiv=3D'Content-Ty=
pe' />
  </head>
      <body>
       =

   <h1>Jums nos=C5=ABt=C4=ABta jauna zi=C5=86a no SIA "Ecotechno" m=C4=81=
jaslapas izmantojot kontaktformu</h1>
    =

            =

        <li>S=C5=ABt=C4=ABt=C4=81js: </li>
        <li>Temats:</li>
        <p>Zi=C5=86as teksts: </p>
    =

    </body>
</html>

My contact form:

 <%= form_for(@message) do |f| %>                        
    <label for="author">Name:</label>
      <%= text_field_tag 'senders_name', nil, class: 'required input_field' %>
          <div class="cleaner h10"></div>
          <label for="email">Email:</label> 
      <%= text_field_tag 'email', nil, class: 'validate-email required input_field' %>
        <div class="cleaner h10"></div>
                <label for="subject">Subject:</label>
        <%= text_field_tag 'title', nil, class: 'input_field' %>
            <div class="cleaner h10"></div>
                     <label for="text">Message:</label> 
        <%= text_area_tag 'message_text', nil, class: 'required' %>     
                  <div class="cleaner h10"></div>
    <%= submit_tag("Send",:id=>"submit",:class=>"submit_btn float_l") %>

    <input type="reset" value="Reset" id="reset" name="reset" class="submit_btn float_r" />


    <%end%>

My config/initializers/setup_mail.rb

ActionMailer::Base.smtp_settings = {
  :address              => "mail.ecotechno.lv",
  :port                 => 26,
  :domain               => "ecotechno.lv",
  :user_name            => "mailer@ecotechno.lv",
  :password             => "mypassw",
  :authentication       => "plain",
  :enable_starttls_auto => true
}
Was it helpful?

Solution

In config/environments/development.rb, add bellow code to use SMTP. config.action_mailer.delivery_method = :smtp

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