我有問題,在我的本地,與線路2.3.2和的Ruby 1.8.6。 development.log顯示它發送了沒有錯誤的電子郵件,但沒有收到電子郵件。我嘗試了多個電子郵件地址進行發送和接收,並嘗試了多個配置和插件,但無法發送電子郵件。任何幫助將不勝感激 - 我覺得我正在圍繞着不同版本的rails和ruby的一系列解決方案跳舞,並且無法完成它。我非常感謝任何評論。謝謝!的ActionMailer郵件「發送」,但沒有收到
插件:
- 行動郵件可選TLS
- smtp_tls
不同的電子郵件CONFIGS:
ActionMailer::Base.smtp_settings = {
:enable_starttls_auto => true, #works in ruby 1.8.7 and above
:address => 'smtp.gmail.com',
:port => 587,
:domain => 'example.com',
:authentication => :plain,
:user_name => 'testacct',
:password => 'secret'
}
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:tls => :true,
:address => 'smtp.gmail.com',
:port => 587,
:authentication => :plain,
:user_name => '[email protected]',
:password => 'secret'
#:enable_starttls_auto => true # for rails >= 2.2 && ruby >= 1.8.7
}
config.action_mailer.perform_deliveries = :true #try to force sending in development
config.action_mailer.raise_delivery_errors = :true
config.action_mailer.default_charset = "utf-8"
Development.log:
Sent mail to [email protected]
Date: Fri, 18 Dec 2009 00:27:06 -0800
From: Test Email Acct <[email protected]>
To: [email protected]
Subject: Signup
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary=mimepart_4b2b3cda9088_634334302a5b7
--mimepart_4b2b3cda9088_634334302a5b7
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: Quoted-printable
Content-Disposition: inline
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://ww=
w.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang=3D'en' xml:lang=3D'en' xmlns=3D'http://www.w3.org/1999/xhtml'>=
<head>
<meta content=3D'text/html;charset=3DUTF-8' http-equiv=3D'content-typ=
e' />
</head>
<body>
Welcome Email
<p>
user name:
lfglkdfgklsdf
activation link:
http://localhost:3000/login
</p>
</body>
</html>
--mimepart_4b2b3cda9088_634334302a5b7--
檢查那些被標記爲垃圾郵件。 – Waseem 2009-12-18 11:09:11
沒有。不是垃圾郵件。 – user117046 2009-12-18 22:36:40
謝謝你們,不知道發生了什麼事情(或許與smtp服務器有關),但它今天的作品具有相同的確切代碼。 GUH。 – user117046 2009-12-18 22:38:57