在onoku上发送的Ruby on Rails电子邮件未收到

时间:2013-06-12 22:30:07

标签: ruby-on-rails email heroku

我无法通过联系页面正确发送电子邮件。该页面在heroku上托管的rails上运行ruby,并且根据papertrail它正在被发送而没有错误。日志如下:

    Jun 12 15:14:37 dry-woodland-1410 app/web.1:  Processing by ontactController#create as HTML Jun 12 15:14:37 dry-woodland-1410 app/web.1:    Parameters: {"utf8"=>"✓",authenticity_token"=>"IRu+hjuGuo0Dw5hM0jOOAxFqyT6CXoubk5TocJqw7w4=", "message"=>{"name"=>"example", "email"=>"example@example.com", "subject"=>"subject", "body"=>"body"}, "commit"=>"Send"} Jun 12 15:14:38 dry-woodland-1410 app/web.1:    Rendered contact_mailer/new_message.text.erb (0.1ms) Jun 12 15:14:38 dry-woodland-1410 app/web.1:  Sent mail to contact@akimono.com (127ms) Jun 12 15:14:38 dry-woodland-1410 app/web.1:  Redirected to http://dry-woodland-1410.herokuapp.com/products 

以下是联系人控制器的代码:

    class ContactController < ApplicationController
def new
    @message = Message.new
    @cart = current_cart
end
def create
    @message = Message.new(params[:message])
    @cart = current_cart
    if @message.valid?
        ContactMailer.new_message(@message).deliver
        redirect_to(products_path, :notice => "Your message was successfully sent. If you do not hear back in one business day please resend.")
    else
        flash.now.alert = "Please fill all fields."
        render :new
    end
    end   
    end

以下是联系人新视图的代码:

    <%= form_for @message, :url => contact_path do |form| %>
    <fieldset class="fields">
<div class="field">
    <%= form.label :name %>
    <%= form.text_field :name %>
</div>

<div class="field">
    <%= form.label :email %>
    <%= form.text_field :email %>
</div>
<div class="field">
    <%= form.label :subject %>
    <%= form.text_field :subject %>
</div>
<div class="field">
    <%= form.label :body%>
    <%= form.text_field :body %>
</div>
    </fieldset>
    <fieldset class="actions">
<%= form.submit "Send" %>
</fieldset>
<% end %>

我到处看都看不清楚为什么消息实际上没有被发送,并且即使一切似乎都已到位,也没有抛出错误消息。

联系邮件代码:

    Name: <%= @message.name %>

    Email: <%= @message.email %>

    Subject: <%= @message.subject %>

    Body: <%= @message.body %>

0 个答案:

没有答案