发送电子邮件从本地主机 [英] send email from localhost

查看:148
本文介绍了发送电子邮件从本地主机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试着通过rails了解电子邮件。我在localhost上开发一些东西。可以从localhost发送一封电子邮件,说一般的邮件帐户,如gmail?我有安装邮件服务器吗?

解决方案

更新rails 4.0

现在您需要这些代码才能使其工作:

 #我建议使用此行显示错误
config。 action_mailer.raise_delivery_errors = true

ActionMailer :: Base.smtp_settings = {
:address => 'smtp.gmail.com',
:domain => 'mail.google.com',
:port => 587,
:user_name => 'foo@gmail.com',
:password => '******',
:authentication => :plain,
:enable_starttls_auto => true
}


I'm try learn about email in rails. I'm developing something on localhost. Is it possible to send an email from localhost to say a normal mail account like gmail? Do I have a install a mail server? I've just got a standard rails installation at the moment for development.

解决方案

Update for rails 4.0
Now you need these code to make it work:

# I recommend using this line to show error
config.action_mailer.raise_delivery_errors = true

ActionMailer::Base.smtp_settings = {
  :address        => 'smtp.gmail.com',
  :domain         => 'mail.google.com',
  :port           => 587,
  :user_name      => 'foo@gmail.com',
  :password       => '******',
  :authentication => :plain,
  :enable_starttls_auto => true
}

这篇关于发送电子邮件从本地主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆