require'mail'Mail.defaultsdodelivery_method:smtp,{:address=>"smtp.sendgrid.net",:port=>587,:domain=>"yourdomain.com",:user_name=>"yourusername@domain.com",:password=>"yourPassword",:authentication=>'plain',:enable_starttls_auto=>true}endmail=Mail.deliverdoto'yourRecipient@domain.com'from'Your Name <name@domain.com>'subject'This is the subject of your email'text_partdobody'Hello world in text'endhtml_partdocontent_type'text/html; charset=UTF-8'body'<b>Hello world in HTML</b>'endend
To install the Mail gem please note that you need the OpenSSL library installed, then run the following: