[GEM] ruby-gmail – Send Email easily


sudo apt-get install ruby rubygems

sudo gem install ruby-gmail

Wow Its very easy to send email from “ruby” is very easy using “ruby-gmail”

Only four lines 🙂

require 'rubygems'
require 'gmail'
username = 'username' //sathia27
password = 'password' //your password
recipient = ARGV[0]
sub = ARGV[1]
message = ARGV[2]

Gmail.new(username, password) do |gmail|
	gmail.deliver do
	  to recipient+'@gmail.com'
	  subject sub
	  text_part do
	    body message


Usage :

ruby gmail.rb sathia2704(username) “your_subject” “body of message “


About sathia

Web developer at cloudmint
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s