smtp - how to send email from rails app with gmail address -


I am trying to send a sample email from my rail application.

I have done so far:

  Rail gmailtest cd gmailteest script / plugin installed git: //github.com/collectiveidea/action_mailer_optional_tls.git  < / Pre> 

Then I placed the ActionMailer in my environment.rb file ( end )

  the following: Base smtp_settings = {: address = & gt; "Smtp.gmail.com" ,: port = & gt; 587,: domain = & gt; "Mygmail@gmail.com" ,: user_name = & gt; "Mygmail@gmail.com" ,: Password = & gt; "Mypwd" ,: Authentication = & gt; : Plain} script / mailer user mailer  

then model \ UserMailer :

  class UserMailer < ActionMailer :: Base Def Receipts - Email (email) recipients to "My amazing site notifications" & lt; notifications@example.com> " Email from the topic "Welcome to my amazing site" sent time. Now # people {: user = & gt; "",: Url = & gt; "Http: //example.com/login"} and end << code>  

views \ user_mailer \ welcome_email.text.html .erb

  & lt ;! DOCTYPE html public "- // W3C // DTD XHTML 1.0 Transcription // N" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" & gt; & Lt; Html & gt; & Lt; Top & gt; & Lt; Meta content = "text / html; charset = UTF-8" http-equiv = "content-type" /> & Lt; / Head & gt; & Lt; Body & gt; & Lt; H1 & gt; Welcome example.com, & lt; / H1> & Lt; P & gt; You have successfully signed up for example, and your username is:. & Lt; Br / & gt; To login to the site, just follow this link:. & Lt; / P & gt; & Lt; P & gt; Join and have a great day! Thank You for! & Lt; / P & gt; & Lt; / Body & gt; & Lt; / Html & gt;  

Tried to send email!

  & gt; & Gt; UserMailer.deliver_welcome_email ("myemailaccount@gmail.com") = & gt; # & Lt; TMail :: Mail Port = # & lt; TMail :: StringPort: id = 0x4bf7c42 & gt; Bodyport = # & lt; TMail :: StringPort: ID = 0x4bd4c1a & gt; & Gt;  

Now I do not know whether the setup is working or not ?? Can I send a sample email ( script / console ) from the command prompt to ensure that the setup is working?

In addition to the Domain section, I only have my email, is it OK or should I have a domain from Google?

This email does not send

Yes.

  Script / Console UserMailer.deliver_welcome_email ("myemailaccount@gmail.com")  

should be sent (if all your settings / codes are correct).


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -