How to send emails through Ruby on rails in linux - ruby-on-rails

I want to include a new module to my project where i can send some mails to my client.I don know how to include this emailing module . i searched in net but most of them have told to edit some SMTP.Where can i find this in linux.I am really confused about this.Plz guide me out.I need it urgently.

You need to setup a mail server like Exim4 on your server. Rails should be able to connect to it without any configuration.
The Rails Guides site has a great tutorial on how to send mail from your application.

Related

sending and receiving activation emails - ruby on rails tutorial by michael hartl

I recently started following Hartl's Ruby on Rails tutorial.
I downloaded the existing sample_app_reference app from bitbucket.
My goal is not to start and learn everything from scratch but rather to add new features to the already existing app.
The issue is that I can't test the features I'm adding since I can't activate my account locally. In order to activate my account, I need to receive an activation email (which I'm not). I've searched the web for hours, but couldn't find anything regarding the issue. Did anyone try this tutorial before and encountered the same problem? Any help would be much appreciated.
Yeah...sending emails from dev environment is often not straightforward. As Vasilisa comments above, the quickest fix for your need is to activate the user from the rails console...perhaps like this:
% bundle exec rails console
my-app(development)> User.last.activate
However, there will be other times when you actually want to see the email in the context of a mail client. For this, https://mailcatcher.me/ makes it super easy. Just install the mailcatcher gem -- not in your app's Gemfile, but on your local machine's ruby installation.
Then, change the host and port in app/config/development.rb (NOT in other environemnts, like prod!)
config.action_mailer.smtp_settings = {
# For use with Mailcatcher: https://mailcatcher.me/
address: '127.0.0.1',
port: 1025
}
Run mailcatcher once from a command prompt.
Then, do your thing in your app to trigger an email send, and open http://127.0.0.1:1080/ in your browser. Voila, you see your email like it was really sent.
This a super-easy, super-useful way to see real emails without setting up your local env to actually send emails.

Heroku App with a Wordpress Blog

I recently discovered that Heroku now allows PHP which means that a wordpress blog can be hosted on it. I also found this project template: https://github.com/mhoofman/wordpress-heroku
I have a ruby on rails app which is to be hosted on heroku with a domain www.mysite.com, and in that app, i need a way for www.mysite.com/blog to show the wordpress blog.
Can someone help me out, with details on how I can do this?
Whilst I've not used the new PHP platform I don't think what you're asking for is going to be possible.
When you deploy an application to Heroku it detects the type of application during the push process and sets up the application accordingly, Heroku use Apache to host PHP as you can see from the output in this post http://tjstein.com/2011/09/running-wordpress-on-heroku-and-amazon-rds/ - there's not been any mention of mixing platforms in a single application yet so would imagine that it's not supported.
The nearest you'd get is hosting your site and your blog in two seperate applications with the blog on blog.mysite.com and then put a redirect on www.mysite.com/blog to the blog.mysite.com url.
Im Still working on this
the closest to getting a solution is using the reverse proxy gem
see the answer here:
How can I use a subdirectory instead of a subdomain?

Using Windows Authentication in Ruby on Rails

I'm working on a Rails app for an internal project and can't work out how to set up the users model to use Windows Authentication for logging in. I had a look and can't find anything that was covering this topic. I've managed to configure Rails to use SQLServer fine but I'm just blanking here.
Thanks in advance.
Maybe this article helps: http://www.zorched.net/2007/06/04/active-directory-authentication-for-ruby-on-rails/

How do I send signed emails from ActionMailer in Rails 3?

Using Rails 3 I want to use an X.509 certificate to sign parts of emails. There is a currently existing answer for Rails 2 at How do I send signed emails from ActionMailer? but it doesn't work on Rails 3.
Is it possible to sign emails via ActionMailer in Rails 3?
If that is not possible, is it possible to sign emails via sendmail after creating by ActionMailer?
perhaps it's not the best answer, however here's what I'd do:
try to install that plugin (even if it's for rails 2.0.x)
tests and fix code until I get the result
looking at the code, turns out that the core file is:
https://github.com/penso/actionmailer_x509/blob/master/lib/actionmailer_x509.rb
which exposes a bunch of methods for mailer DSL:
x509_sign true # or false
x509_cert "path/to/cert"
x509_key "path/to/key"
x509_passphrase "passphrase"
so you could grab that file, and put it under $APP/lib, then write some test to check it's working.
A.
I have been ported actionmailer_x509 to Rails 3 and wrap it into the gem. So now it works and available here: https://github.com/petRUShka/actionmailer_x509

AR Mailer with changing settings?

we're running ARMailer in one of our projects right now.
It's working fine but as different customers are allowed to send confirmation emails via this service we want to offer them the possibility to use their own SMTP settings for that.
Is there a way to change ARMailer settings on the fly?
Or is there an ARMailer alternative maybe which abstracts this better?
Thanks
Matt
this: Using multiple SMTP accounts with Rails & ActionMailer
has a nice example using yaml for storing the multiple configurations, but can easily be adapted to use the db
What I did in the end was:
I took the ARMailer gem and took a copy of it.
After that, modified the email delivery action and started the daemon from my new custom folder. Works fine. Will create a custom some day...

Resources