简体   繁体   English

Action Mailer无法在开发模式下工作,Rails

[英]Action Mailer not working on development mode, Rails

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 : 我的Rails应用日志文件:

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 我的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
}

In config/environments/development.rb, add bellow code to use SMTP. 在config / environments / development.rb中,添加以下代码以使用SMTP。 config.action_mailer.delivery_method = :smtp

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM