2011-04-13 65 views
0

我正在尝试创建一个电子邮件地址。我已将sendgrid插件添加到我的应用程序中。Heroku actionmailer如何

这里是我的application.rb中

module Konkurranceportalen 
    class Application < Rails::Application 
    # Settings in config/environments/* take precedence over those specified here. 
    # Application configuration should go into files in config/initializers 
    # all .rb files in that directory are automatically loaded. 
    config.action_mailer.delivery_method = :smtp 
    ActionMailer::Base.smtp_settings = { 
    :address => "smtp.mydomain.com", 
    :port => 25, 
    :user_name => "[email protected]", 
    :password => "mypass", 
    :authentication => :login 
} 
end 
end 
+0

问题是什么?你没有工作吗?你有错误吗? – 2011-04-13 08:18:36

+0

当我尝试在thunderbird上登录并发送邮件到[email protected]时出现错误 – 2011-04-13 08:20:26

+0

我应该使用sendgrids SMTP服务器还是使用Rails构建? – 2011-04-13 08:23:45

回答

0

要创建像[email protected]你需要一个邮件Exhange主机的常规电子邮件。

当你choicen邮件exhange主机,你可以创建一个像[email protected]

现在你需要设置MX记录你的DNS服务器

而且足底对你有一个像邮件发送一个电子邮件邮件@ yourdomain.com

0

这并不像你需要使用SendGrid与在Heroku编码 - 文档有你需要的所有细节,here

+0

如何创建电子邮件地址,例如[email protected] – 2011-04-13 09:32:29

+0

指定在您的动作邮件程序中,请参阅http://edgeguides.rubyonrails.org /action_mailer_basics.html – 2011-04-13 10:59:53

+0

澄清,该代码段是通过SMTP将您的应用程序连接到SendGrid所需的设置。然后您需要使用actionmailer发送您的电子邮件。 – 2011-04-13 11:42:29

1

您需要更改Sendgrid设置:

ActionMailer::Base.smtp_settings = { 
    :address  => "smtp.sendgrid.net", 
    :port   => "25", 
    :authentication => :plain, 
    :user_name  => ENV['SENDGRID_USERNAME'], 
    :password  => ENV['SENDGRID_PASSWORD'], 
    :domain   => ENV['SENDGRID_DOMAIN'] 
+0

我是否需要创建一个sendgrid帐户? – 2011-04-13 09:09:32

+0

如何创建电子邮件地址,例如[email protected] – 2011-04-13 09:32:04

+0

不,从Heroku您不需要。你只需要将Sendgrid添加到你的应用程序中:'heroku addons:add sendgrid:free' – 2011-04-13 09:44:55