Tag: 邮件

邮件中的“普通”authentication_type是什么?

查看动作邮件程序的Rails指南,动作邮件程序smtp_settings中的“普通” authentication_type是什么意思? 这是否意味着我的密码将以明文forms发送? (如果有帮助,我使用gmail作为smtp提供程序。)

有关如何根据关联向多个用户发送电子邮件的建议

我创建了一个Ruby on Rails应用程序,用户可以在其中跟踪锻炼。 可以私下或公开地这样做。 在公开的训练中( workout.share == 1 )我允许用户发表评论。 在锻炼中创建评论时,将通过电子邮件通知锻炼所有者。 一切都很好。 我现在正在寻找一些关于允许评论锻炼的用户的最佳方式的建议,也可以通过电子邮件通知。 这是一个例子。 用户A创建锻炼1.用户B对锻炼1的评论和用户A收到电子邮件通知。 用户C还对Workout 1发表评论,用户A和用户B都接收电子邮件通知。 告诉我的应用程序循环浏览已对Workout 1发表评论并向其发送电子邮件的所有用户的最佳方法是什么? 目前,我正在使用comments_controller中的以下代码向锻炼所有者发送电子邮件(我意识到这可能是更干净的代码): class CommentsController < ApplicationController … def create @workout = Workout.find(params[:workout_id]) @comment = @workout.comments.build(params[:comment]) @comment.user = current_user respond_to do |format| if @comment.save if @comment.workout.email_notification == 1 @comment.deliver_comment_notification_mail! format.html { redirect_to( projects_path) } format.js else format.html { redirect_to( […]

在生产服务器(DigitalOcean)上的rails app中使用SMTP(mailgun)发送电子邮件的端口是什么?

我在使用capistrano和mailgun配置的数字海洋液滴中部署了一个rails应用程序,但我在发送电子邮件时遇到问题,我使用delayed_jobs执行任务。 事情是每次它尝试发送电子邮件我得到连接超时(使用RAILS_ENV=production bin/delayed_jobs run在服务器中RAILS_ENV=production bin/delayed_jobs runvalidation)我发现由于某种原因数字海洋不允许默认为您通过端口访问587(事实上,运行telnet smtp.mailgun.org 587需要很长时间才能访问)但显然可以通过2525端口(mailgun也支持该端口并运行telnet smtp.mailgun.org 2525即时连接!)。 但同样,它仍然给我连接超时,所以我有点困惑,不知道该怎么做。 我可能会向DO发票要求打开587端口,直到那时你有什么想法吗?

使用Rails 4.1 ActionMailer :: Preview预设电子邮件需要设置哪些路由?

class UserPreview < ActionMailer::Preview # Accessible from http://localhost:3000/rails/mailers/notifier/welcome_email def welcome_email UserMailer.welcome_email(User.first) end end 我使用Ruby on Rails 4.1进行了这个简单的邮件预览。 如果我注释掉我的routes.rb文件中的所有路由并且仅保留此信息,则邮件程序预览会起作用: MyTestApp::Application.routes.draw do end 显然,我的一个权利是在默认的Rails之前用于邮件预览。 我需要输入路由rb文件?

Rails 3,未知validation器:’EmailValidator’

我尝试在我的rails应用程序中添加一个电子邮件validation器。 我创建了以下文件/lib/validators/email_validator.rb class EmailValidator < ActiveModel::EachValidator def validate_each(object, attribute, value) unless value =~ /^([^@\s]+)@((?:[-a-z0-9]+\.)+[az]{2,})$/i object.errors[attribute] << (options[:message] || "is not formatted properly") end end end 在application.rb中我添加了这一行: config.autoload_paths << "#{config.root}/lib/validators" 这是我的用户模型: class User true, :uniqueness => true, :email => true end 如果我想启动服务器,我收到一个错误: Unknown validator: ‘EmailValidator’ (ArgumentError) 有谁知道如何解决这个问题?

接收和处理电子邮件:Heroku,Sendgrid,可能还有Mailman

我的应用为每个用户创建一个唯一的电子邮件,用户将电子邮件发送到该地址进行处理。 使用Sendgrid,我将传入的电子邮件通过管道传输到我的域(在Heroku上托管)到一个地址: site.com/receive_email 我使用TO字段来确定用户,因为电子邮件地址是随机生成的(可能是那里的安全问题,但只是在我身边) 我已经尝试过使用像Mailman这样的外部脚本,但由于我是在Heroku上托管的,我需要让一名工作人员全职运行来保持这个过程。 此测试应用程序目前还没有真正寻找它。 这使得它作为POST请求处理。 我可以在receive_emails访问POST哈希(params [“subject”]等)。 这是我被卡住的地方 您是否建议处理POST params中的原始数据,或者我可以使用Mailman或ActionMailer之类的东西为我处理电子邮件?

Actionmailer SMTP服务器响应

当通过动作管理器发送邮件时,动作邮件程序会从SMTP服务器获取响应,当它正常或者错误时。 有没有办法在发送邮件后检索此响应? 当SMTP服务器没有抛出错误时? 我们的qmail邮件服务器会抛出一个我们想要用来跟踪电子邮件的处理程序ID。 例如,服务器响应如下: 250 ok 1308235825 qp​​ 17832

如何在Rails中的确认电子邮件中传递选项哈希中的额外参数?

我试图在确认电子邮件中的选项{}哈希中传递额外的参数,但它只显示主题和邮件中的标题。 这是我的代码 CustomMailer.confirmation_instructions(user,token, {custom_param: “abc”}) 当我在这样的模板中显示opts数据时 @first_name = opts 表明 {:subject=>”Email Confirmation”, :from=>”no-reply@sample.com”} 自定义邮件代码是 class CustomMailer < Devise::Mailer helper :application # gives access to all helpers defined within `application_helper`. include Devise::Controllers::UrlHelpers # Optional. eg. `confirmation_url` #include ApplicationHelper default template_path: 'devise/mailer' # to make sure that you mailer uses the devise views def confirmation_instructions(record, token, opts={}) […]

如何更改“设计:密码重置指令电子邮件的主题”

我只是无法更改“密码重置说明”电子邮件的主题。 我在Mailer中更改了notifer.rb以覆盖Devise默认电子邮件主题。 但它不起作用。 在我的应用程序中,Devise .yml文件中有默认的电子邮件主题。 但我希望通过从数据库中提取数据来使其动态化。

在Rails中联系Form Mailer 4

我正在尝试在Rails 4中构建一个联系表单,其中表单采用名称,电子邮件和正文,并将其发送到我的电子邮件地址。 点击“提交”后,该应用会正确地重定向回联系人页面,但似乎没有电子邮件发送。 的routes.rb match ‘/send_mail’, to: ‘contact#send_mail’, via: ‘post’ contact_email.html.erb true %> true %> You have received the following email from contact_controller.rb def send_mail name = params[:name] email = params[:email] body = params[:comments] ContactMailer.contact_email(name, email, body).deliver redirect_to contact_path, notice: ‘Message sent’ end contact_mailer.rb class ContactMailer < ActionMailer::Base default to: # my email address def […]