Tag: mailgun

Cloud9和ActionMailer / Mailgun?

我希望你能帮帮忙! 我曾经在本地开发,但我在国外,我正在使用Cloud9来处理一些项目。 目前,使用Action Mailer让我很难过。 我的ActionMailer初始化程序: ActionMailer::Base.smtp_settings = { port: ‘2525’, address: ‘smtp.mailgun.org’, user_name: ENV[‘MAILGUN_SMTP_LOGIN’], password: ENV[‘MAILGUN_SMTP_PASSWORD’], domain: ‘app07ad98bdda3b4c469a24228512cffe5c.mailgun.org’, authentication: :plain, content_type: ‘text/html’ } ActionMailer::Base.delivery_method = :smtp 邮寄/ gun_mailer.rb class GunMailer < ActionMailer::Base default from: "from@example.com" def welcome_email(user) @user = user @url = 'http://example.com/login' mail(to: @user.email, subject: 'Welcome to My Awesome Site') end end 视图/ gun_mailer […]

将通过Mailgun通过电子邮件发送和处理的信息保存到我的应用中

我已经设置了Heroku和Railgun,以便能够从电子邮件中获取内容并存储它。 我已经明白,当电子邮件被发送到mailgun时,它们会被转发到我的应用程序,并且我的消息模型的空实例会自动创建,但是,电子邮件中没有任何字段被存储(尽管有匹配的schema(例如from:string subject:string etc))。 我的问题是我无法弄清楚如何获取HTTP POST请求的内容并对其进行处理,以便每条消息都存储有相应的信息。 我可以看到它进入heroku(通过heroku日志),但无法存储它。 我希望首先存储以下字段: 从 学科 附件 目前我的messages_controller.rb看起来像这样 def create @message = Message.new(params[:message]) respond_to do |format| if @message.save format.html { redirect_to @message, notice: ‘Message was successfully created.’ } format.json { render json: @message, status: :created, location: @message } else format.html { render action: “new” } format.json { render json: @message.errors, status: […]

已validation的电子邮件不通过Heroku / Mailgun发送

我在Heroku上有Rails应用程序。 它有一个自定义域,我试图通过Mailgun设置电子邮件发送。 我已经通过Heroku安装了Mailgun作为插件,我已经完成了Mailgun给出的“validation”我的自定义域的步骤。 如果我运行Mailgun的“立即检查DNS记录”,一切都会变回绿色,状态为“活动”。 我甚至可以通过他们提供的curl调用从我的自定义域发送消息。 但是,当我尝试使用ActionMailer从我的Rails应用程序发送电子邮件时,我得到: Net::SMTPFatalError (554 Sandbox subdomains are for test purposes only. Please add your own domain or add the address to authorized recipients in domain settings. 为什么它认为我使用的是“Sandbox子域”? 这是我在environments/production.rb : # Mailgun ActionMailer::Base.smtp_settings = { port: ENV[‘MAILGUN_SMTP_PORT’], address: ENV[‘MAILGUN_SMTP_SERVER’], user_name: ENV[‘MAILGUN_SMTP_LOGIN’], password: ENV[‘MAILGUN_SMTP_PASSWORD’], domain: ‘my-custom-domain.com’, authentication: :plain, } ActionMailer::Base.delivery_method = :smtp # […]

ActionMailer响应“501 5.5.4无效参数”

我正在使用Ruby 2.0.0上的Rails 4开发应用程序。 应用程序在Devise中注册后发送电子邮件。 这是发送电子邮件的代码: 应用程序/模型/ sponsor.rb: after_create :send_email_to_admin private def send_email_to_admin AdminMailer.new_sponsor_email(self).deliver end 应用程序/邮寄者/ admin_mailer.rb class AdminMailer < ActionMailer::Base default to: '**removed**' def new_sponsor_email(sponsor) @sponsor = sponsor p @sponsor mail(subject: "New Sponsor Registration") end end 这是从日志文件生成的电子邮件: Sent mail to **removed** (725.5ms) Date: Mon, 02 Sep 2013 15:01:03 -0400 From: **removed** To: **removed** Message-ID: Subject: […]