Ciao raga,
sono circa 2 giorni che non riesco a far inviare tramite ActionMailer
l’email di conferma di registrazione al mio sito:
Vi spiego , un utente si registra e mette i dati e anche la sua mail ,
per mandare la mail faccio su
config/environment/development.rb :
config.action_mailer.raise_delivery_errors = false
ActionMailer::Base.delivery_method = :smtp
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings ={
:enable_starttls_auto => true,
:address => ‘smtp.gmail.com’,
:port => 587,
:domain => ‘myapp.com’,
:user_name => '[email protected]
:password =>‘miapassword’
}
poi sul modello emailer.rb faccio il metodo :
def contact(recipient, sent_at = Time.now)
recipients recipient
subject "[Signed up] Welcome #{recipient}"
from "[email protected]"
body :recipient => recipient
end
e nel mio controllore inserisco nel metodo relativo alla registrazione ,
e anche all’inserimento dei dati su mysql , il codice :
Emailer.deliver_contact(@user.email)
Per quanto riguarda gli esiti mi dice che la mail è stata inviata , ma
io nn ricevo nulla , ecco quello che mi dice :
Processing AccountController#signup (for 127.0.0.1 at 2010-09-15
12:05:02) [POST]
Parameters: {“commit”=>“Sign up”,
“authenticity_token”=>“l2DAl4VXmqqKRCQ1fS+blPDNHyfQAza7aw/SKra8V84=”,
“user”=>{“password_confirmation”=>“llll”, “password”=>“llll”,
“login”=>“llll”, “email”=>“[email protected]”}}
e[4;36;1mUser Columns (5.7ms)e[0m e[0;1mSHOW FIELDS FROM users
e[0m
e[4;35;1mSQL (0.1ms)e[0m e[0mBEGINe[0m
e[4;36;1mUser Load (0.3ms)e[0m e[0;1mSELECT users
.id FROM users
WHERE (LOWER(users
.login
) = BINARY ‘llll’) LIMIT 1e[0m
e[4;35;1mUser Load (0.2ms)e[0m e[0mSELECT users
.id FROM users
WHERE (LOWER(users
.email
) = BINARY ‘[email protected]’) LIMIT 1e[0m
e[4;36;1mUser Create (0.2ms)e[0m e[0;1mINSERT INTO users
(salt
,
created_at
, crypted_password
, remember_token_expires_at
,
updated_at
, remember_token
, login
, email
)
VALUES(‘605cbd84021de7af033bbd5a468daf8d4b6f5b08’, ‘2010-09-15
10:05:02’, ‘f5883dc04f19e9914da0f920b53d1f1e46b081cd’, NULL, ‘2010-09-15
10:05:02’, NULL, ‘llll’, ‘[email protected]’)e[0m
e[4;35;1mSQL (1.6ms)e[0m e[0mCOMMITe[0m
Sent mail to [email protected]
Date: Wed, 15 Sep 2010 12:05:02 +0200
From: [email protected]
To: [email protected]
Subject: [Signed up] Welcome [email protected]
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Hi!
You are having one email message from with a tilte
and following is the message:
Thanks
Redirected to http://127.0.0.1:3000/account
Completed in 313ms (DB: 8) | 302 Found [http://127.0.0.1/account/signup]
Cosa posso fare?
Help me