使用runco​​pe与mailgun - 从哪里开始?

时间:2015-03-05 10:44:55

标签: ruby-on-rails mailgun runscope

我已经设置了rails应用程序来接收邮件并从中创建书签。因此我加入了宝石' mailgun'。因为它无法正常工作,但是我想使用runco​​pe来更好地了解发送哪些数据。

我已在我的应用程序中完成以下步骤: 1.将邮件添加到heroku 2.设置初始化程序

ActionMailer::Base.smtp_settings = {
 port:              587, 
 address:           'smtp.mailgun.org',
 user_name:         ENV['MAILGUN_SMTP_LOGIN'],
 password:          ENV['MAILGUN_SMTP_PASSWORD'],
 domain:            'appurlhere.com',
 authentication:    :plain,
 content_type:      'text/html' 
}
ActionMailer::Base.delivery_method = :smtp

# Makes debugging *way* easier. 
ActionMailer::Base.raise_delivery_errors = true
  1. 设置传入路径

    帖子:传入,传入:'传入#create'

  2. 创建传入控制器

    def create
     @user = User.find_by_email(params[:sender])
     @topic = @user.topics.find_by(title: params[:subject])
     @url = "http://#{params["body-plain"]}"
    
     @user = User.create(email: params[:sender], password: "#{params[:subject]}") if @user.nil?
     @topic = Topic.create(title: params[:subject], user_id: @user.id) if @topic.nil?
     @bookmark = Bookmark.create(topic_id: @topic, user_id: @user, url: "what should be here")
     head 200
    end
    
  3. 但现在我无法调整代码,因此我可以更好地查看更好的数据(和调试)。我尝试在mailgun中添加代码到我的路线但是没有用。

0 个答案:

没有答案