Module | Ramaze::Helper::Email |
In: |
lib/ramaze/helper/email.rb
|
The Email helper can be used as a simple way of sending Emails from your application. In order to use this helper you first need to load it:
class Comments < Ramaze::Controller helper :email end
Sending an Email can be done by calling the method send_email():
send_email( 'user@domain.tld', 'Hello, world!', 'Hello, this is an Email' )
Ramaze will log any errors in case the Email could not be sent so you don‘t have to worry about this.
## Options
This module can be configured using Innate::Optioned. Say you want to change the SMTP host you simply need to do the following:
Ramaze::Helper::Email.options.host = 'mail.google.com'
Various other options are available, for a full list of these options run the following in an IRB session:
puts Ramaze::Helper::Email.options
By default this helper uses ``\r\n`` for newlines, this can be changed as following:
Ramaze::Helper::Email.options.newline = "\n"
@author Yorick Peterse @author Michael Fellinger @since 16-06-2011
Sends an Email over SMTP.
@example
send_email('user@domain.tld', 'Hello, world!', 'Hello, this is an Email')
@author Yorick Peterse @author Michael Fellinger @since 16-06-2011 @param [String] recipient The Email address to send the Email to. @param [String] subject The subject of the Email. @param [String] message The body of the Email