# Mail per confermare registrazione a sitoweb con ActionMailer

**URL:** <https://www.ruby-forum.com/t/mail-per-confermare-registrazione-a-sitoweb-con-actionmailer/195015>\
**Category:** IT\
**Created:** [September 15, 2010, 12:15pm UTC](https://www.ruby-forum.com/t/mail-per-confermare-registrazione-a-sitoweb-con-actionmailer/195015 "2010-09-15T12:15:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![chenshin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/dc4da7/32.png) [@chenshin](https://www.ruby-forum.com/u/chenshin)\
**Post date:** [September 15, 2010, 12:15pm UTC](https://www.ruby-forum.com/t/mail-per-confermare-registrazione-a-sitoweb-con-actionmailer/195015/1 "2010-09-15T12:15:48Z")

</div>

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](http://smtp.gmail.com)’,  
:port =\> 587,  
:domain =\> ‘[myapp.com](http://myapp.com)’,  
:user\_name =\> 'removed\_email\_address@domain.invalid  
: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 "removed_email_address@domain.invalid"
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”=\>“removed\_email\_address@domain.invalid”}}  
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 ‘removed\_email\_address@domain.invalid’) 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’, ‘removed\_email\_address@domain.invalid’)e[0m  
e[4;35;1mSQL (1.6ms)e[0m e[0mCOMMITe[0m  
Sent mail to removed\_email\_address@domain.invalid

Date: Wed, 15 Sep 2010 12:05:02 +0200  
From: removed\_email\_address@domain.invalid  
To: removed\_email\_address@domain.invalid  
Subject: [Signed up] Welcome removed\_email\_address@domain.invalid  
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](http://127.0.0.1:3000/account)  
Completed in 313ms (DB: 8) | 302 Found [[http://127.0.0.1/account/signup](http://127.0.0.1/account/signup)]

Cosa posso fare?  
Help me ☹

---

<div class="post-metadata">

**Author:** ![chenshin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/dc4da7/32.png) [@chenshin](https://www.ruby-forum.com/u/chenshin)\
**Post date:** [September 15, 2010, 3:51pm UTC](https://www.ruby-forum.com/t/mail-per-confermare-registrazione-a-sitoweb-con-actionmailer/195015/2 "2010-09-15T15:51:11Z")

</div>

> ```
> def contact(recipient, sent_at = Time.now)
> 
> ```
> 
> recipients recipient  
> subject “[Signed up] Welcome #{recipient}”  
> from “[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)”  
> body :recipient =\> recipient  
> end

Nel from stai usando “[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)”? prova con la tua di  
gmail

---

<div class="post-metadata">

**Author:** ![chenshin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/dc4da7/32.png) [@chenshin](https://www.ruby-forum.com/u/chenshin)\
**Post date:** [September 16, 2010, 10:19am UTC](https://www.ruby-forum.com/t/mail-per-confermare-registrazione-a-sitoweb-con-actionmailer/195015/3 "2010-09-16T10:19:48Z")

</div>

Non ti risolve il problema ma io lo farei cosi’:

[http://api.rubyonrails.org/classes/ActiveRecord/Observer.html](http://api.rubyonrails.org/classes/ActiveRecord/Observer.html)

---

<div class="post-metadata">

**Author:** ![chenshin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/dc4da7/32.png) [@chenshin](https://www.ruby-forum.com/u/chenshin)\
**Post date:** [September 16, 2010, 4:35pm UTC](https://www.ruby-forum.com/t/mail-per-confermare-registrazione-a-sitoweb-con-actionmailer/195015/4 "2010-09-16T16:35:37Z")

</div>

Il 15/09/10 20.44, Peppe D. ha scritto:

> Purtroppo non va neanche così ☹  
> la cosa che mi fa impazzire è che mi dice che l’ha inviata e che tutto è  
> ok , però io non ne ricevo…viceversa se faccio un altro programma con  
> solo il controllore,modello e vista di Emailer mi funziona !!  
> che può essere? :°°(

tcpdump potrebbe intanto esserti d’aiuto per capire se la mail esce  
oppure non viene proprio generata

---

<div class="post-metadata">

**Author:** ![chenshin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/dc4da7/32.png) [@chenshin](https://www.ruby-forum.com/u/chenshin)\
**Post date:** [September 15, 2010, 8:44pm UTC](https://www.ruby-forum.com/t/mail-per-confermare-registrazione-a-sitoweb-con-actionmailer/195015/5 "2010-09-15T20:44:38Z")

</div>

Andrea F. wrote:

> > ï¿½ ï¿½ def contact(recipient, sent\_at = Time.now)  
> > ï¿½ ï¿½recipients recipient  
> > ï¿½ ï¿½subject ï¿½ ï¿½"[Signed up] Welcome #{recipient}"  
> > ï¿½ ï¿½from ï¿½ ï¿½ ï¿½ “[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)”  
> > ï¿½ ï¿½body ï¿½ ï¿½ ï¿½ :recipient =\> recipient  
> > ï¿½end
> 
> Nel from stai usando “[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)”? prova con la tua di  
> gmail

Purtroppo non va neanche cosÃ¬ ☹  
la cosa che mi fa impazzire Ã¨ che mi dice che l’ha inviata e che tutto Ã¨  
ok , perÃ² io non ne ricevo…viceversa se faccio un altro programma con  
solo il controllore,modello e vista di Emailer mi funziona !!  
che puÃ² essere? :Â°Â°(
