Finally!

So apparently there is more than one mailer extension floating around.  One
works with the TLS code, the other does not.

So basically I installed the mailer extension from here (the one that
works).
http://github.com/ntalbott/radiant-mailer-extension/tree/master

Installed the TLS plugin from here:
http://douglasfshearer.com/blog/gmail-smtp-with-ruby-on-rails-and-actionmailer
Look further down the page and you will see that there's an error in the
smtp_tls.rb file where it has 3 arguments and requires 2.  Fix that.

Created a contact page.

Added in the body information.

<r:mailer:form name="contact"> <fieldset> <legend>Enter your contact
information and message.</legend> <r:error on="name"><span>Name is
required.</span></r:error> <label for='name'>Name*</label><br> <r:text
name="name" required="true"/><br> <r:error on="email"><span>Email is
required.</span></r:error> <label for='email'>Email*</label><br> <r:text
name="email" required="true"/><br> <label for='phone'>Phone Number:
xxx-yyy-zzzz</label><br> <r:text name="phone" required="false"/><br>
<r:error on="subject"><span>Subject is required.</span></r:error> <label
for='subject'>Subject*</label><br> <r:text name="subject" required="true"
value="Shaolo.com - "/><br> <label for='message'>Message*</label><br>
<r:error on="message"><span>Message is required.</span></r:error>
<r:textarea name="message" required="true"/><br> <input type="submit"
value="Send"> </fieldset> </r:mailer:form>


Created a mailer part and added in the YAML formatted info

subject: subject from_field: email reply_to_field: email redirect_to:
/contact/thankyou recipients: - "ot...@shaolo.com"


Created an email part and added in the message contents.

Name: <r:mailer:get name="name"/> Email: <r:mailer:get name="email"/> Phone:
<r:mailer:get name="phone"/> <r:mailer:get name="message"/>


Change the environment.rb so it loads actionmailer.

Add in the smtp config info in environment.rb also:

ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.raise_delivery_errors = true

ActionMailer::Base.smtp_settings = {
:tls => true,
:address => "smtp.gmail.com",
:port => 587,
:domain => "dejavubeauty.com",
:authentication => :plain,
:user_name => "myemailformusern...@dejavubeauty.com",
:password => "mysecretpassword"
}


Restart the server.


How did I find all this?  Purely by luck.  I was not getting any errors.  So
I decided to start from scratch by trying this out on my other site
shaolo.com (also using Radiant).  I didn't have the mailer extension
installed yet.  Couldn't remember where I found the extension for the dejavu
site, so I just went ahead and googled, came up with this github and voila,
it all works.

What a pain in the head.






On Sun, Mar 22, 2009 at 7:27 AM, Doug Bryant <doug.bry...@milemeter.com>wrote:

> Anything in the initialiers directory should be automatically loaded.
>
> A very simple way to test if the files are loading is to put a line in the
> top of the smtp_tls.rb & smtp_config.rb files.  Something like:
> puts "Loading Config...." and "Loading TLS Extension..."
>
> If it prints out those two lines, then the files are being loaded.  If it
> doesn't, then in environment.rb, you need to do something like
> require "config/initializers/smtp_tls"
> require "config/initializers/smtp_config"
>
> With raise_deliver_errors turned on, it should be showing you some error
> messages.  You may be correct in thinking the files are not being loaded.
>
> Doug
>
>
>
> On Mar 22, 2009, at 4:14 AM, Shaolo wrote:
>
>  Well, here are what my files look like:
>> smtp_config.rb:
>> ActionMailer::Base.delivery_method = :smtp
>> ActionMailer::Base.raise_delivery_errors = true
>> ActionMailer::Base.perform_deliveries = true
>>
>> ActionMailer::Base.smtp_settings = {
>> :tls => true,
>> :address => "smtp.gmail.com",
>> :port => 587,
>> :domain => "dejavubeauty.com",
>> :authentication => :plain,
>> :user_name => "u...@dejavubeauty.com",
>> :password => "****************"
>> }
>>
>>
>> smtp_tls.rb:
>>
>> It's the bit from github cut and pasted.. Kind of long to put in the
>> email.
>>
>> Those are both in the config/initializers/ directory that I created.
>>
>> Do I need to do something special to load them?
>>
>>
>> This is the "mailer" part from the mail page:
>>
>> subject: "Test" from_field: email redirect_to: /contact/thankyou
>> recipients:
>> - i...@dejavubeauty.com - sh...@dejavubeauty.com
>>
>> This is the "email" part from the mail page:
>>
>> Name: <r:mailer:get name="name"/> E-mail: <r:mailer:get name="email"/>
>> Subject: <r:mailer:get name="subject"/> Message: <r:mailer:get
>> name="message"/>
>>
>> This is the "body" part from the mail page:
>>
>> <r:mailer:form name="contact"> <fieldset> <legend>Enter your contact
>> information and message.</legend> <r:if_error on="name"><span>Name is
>> required.</span></r:if_error> <label for='name'>Name</label><br> <r:text
>> name="name" required="true"/><br> <r:if_error on="email"><span>Email is
>> required.</span></r:if_error> <label for='email'>Email</label><br> <r:text
>> name="email" required="true"/><br> <r:if_error on="subject"><span>Subject
>> is
>> required.</span></r:if_error> <label for='subject'>Subject</label><br>
>> <r:text name="subject" required="true" value="DejaVu - "/><br> <label
>> for='message'>Message</label><br> <r:if_error on="message"><span>Message
>> is
>> required.</span></r:if_error> <r:textarea name="message"
>> required="true"/><br> <input type="submit" value="Send"> </fieldset>
>> </r:mailer:form>
>>
>>
>>
>> This is the output from production.log:
>>
>> Processing MailController#create (for 76.115.250.46 at 2009-03-22
>> 02:27:50)
>> [POST]
>>  Session ID: BAh7CDoMY3NyZl9pZCIlMWRmYThlYmJhZGU0MmRiYzYzNzNiNmI2OWJiMjc1
>> NWEiDHVzZXJfaWRpBiIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxh
>>
>> c2g6OkZsYXNoSGFzaHsABjoKQHVzZWR7AA==--b068953efde7c39050f2430a6ef6437618778ddd
>>  Parameters: {"action"=>"create", "page_id"=>"22",
>> "mailer"=>{"required"=>{"name"=>"true", "subject"=>"true",
>> "message"=>"true", "email"=>"true"}, "name"=>"Shawn Wilton",
>> "subject"=>"DejaVu - ", "message"=>"Test", "email"=>"sh...@shaolo.com"},
>> "controller"=>"mail"}
>> Sent mail to i...@dejavubeauty.com, sh...@dejavubeauty.com
>> Completed in 0.87075 (1 reqs/sec) | Rendering: 0.00120 (0%) | DB: 0.00602
>> (0%) | 200 OK [http://dejavubeauty.com/pages/22/mail]
>>
>>
>> Processing SiteController#show_page (for 76.115.250.46 at 2009-03-22
>> 02:27:51) [GET]
>>  Parameters: {"url"=>["styles.css"], "action"=>"show_page",
>> "controller"=>"site"}
>> Completed in 0.11793 (8 reqs/sec) | DB: 0.00217 (1%) | 200 OK [
>> http://dejavubeauty.com/styles.css]
>>
>>
>> Does anyone see anything wrong with any of that? It still fails to send
>> emails, but there's no errors in the log. It also fails to redirect to the
>> "thankyou" page. But that's probably because it's failing to send the
>> email.
>> _______________________________________________
>> Radiant mailing list
>> Post:   Radiant@radiantcms.org
>> Search: http://radiantcms.org/mailing-list/search/
>> Site:   http://lists.radiantcms.org/mailman/listinfo/radiant
>>
>
> ===
> Doug Bryant
> doug.bry...@milemeter.com
>
>
>
> _______________________________________________
> Radiant mailing list
> Post:   Radiant@radiantcms.org
> Search: http://radiantcms.org/mailing-list/search/
> Site:   http://lists.radiantcms.org/mailman/listinfo/radiant
>



-- 

- Shawn Wilton
- (503) 881-2707
_______________________________________________
Radiant mailing list
Post:   Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Reply via email to