我构建了一个示例应用,试图让邮件工作。该应用程序托管在https://blooming-brushlands-80122.herokuapp.com上, 源代码是here。这是我与动作邮件相关联的配置:
config.action_mailer.delivery_method = :sendmail
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
config.action_mailer.default_options = {from: 'no-reply@example.com'}
并发送邮件
def create
@user = User.new(user_params)
respond_to do |format|
if @user.save
# Sends email to user when user is created.
ExampleMailer.sample_email(@user).deliver
format.html { redirect_to @user, notice: 'User was successfully created.' }
format.json { render :show, status: :created, location: @user }
else
format.html { render :new }
format.json { render json: @user.errors, status: :unprocessable_entity }
end
end
end
该应用不会向用户发送电子邮件。
有谁知道为什么?