<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Jayway Team Blog &#187; gmail</title>
	<atom:link href="http://blog.jayway.com/tag/gmail/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.jayway.com</link>
	<description>Sharing Experience</description>
	<lastBuildDate>Sat, 11 Feb 2012 10:33:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Finding unread mail in Gmail in your browser</title>
		<link>http://blog.jayway.com/2011/10/08/finding-unread-mail-in-gmail-in-your-browser/</link>
		<comments>http://blog.jayway.com/2011/10/08/finding-unread-mail-in-gmail-in-your-browser/#comments</comments>
		<pubDate>Sat, 08 Oct 2011 09:01:36 +0000</pubDate>
		<dc:creator>Tobias Södergren</dc:creator>
				<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[filtering]]></category>
		<category><![CDATA[gmail]]></category>
		<category><![CDATA[unread]]></category>

		<guid isPermaLink="false">http://blog.jayway.com/?p=10057</guid>
		<description><![CDATA[Usually when I have a lot of emails in my inbox, I tend to skim most of them and then mark interesting mails as being unread so that I can read them later on. Sometimes that later on is getting pushed further and further away in the future and suddenly there's a bunch of unread [...]]]></description>
			<content:encoded><![CDATA[<p>Usually when I have a lot of emails in my inbox, I tend to skim most of them and then mark interesting mails as being unread so that I can read them later on. Sometimes that later on is getting pushed further and further away in the future and suddenly there's a bunch of unread mails in my inbox. The<br />
mails are scattered throughout the inbox and trying to find them using by<br />
paginating is quite tedious work. Luckily there's an easier way by using the search box:</p>
<p><code>is:unread label:inbox</code></p>
<p>This will list all unread mails in the inbox. Unfortunately this query is useless when saved<br />
as a filter, as new mail will not be processed by operators such as in:, has: and so on.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jayway.com/2011/10/08/finding-unread-mail-in-gmail-in-your-browser/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Disappearing cursor in Gmail when using Safari</title>
		<link>http://blog.jayway.com/2011/07/07/disappearing-cursor-in-gmail-when-using-safari/</link>
		<comments>http://blog.jayway.com/2011/07/07/disappearing-cursor-in-gmail-when-using-safari/#comments</comments>
		<pubDate>Thu, 07 Jul 2011 08:12:18 +0000</pubDate>
		<dc:creator>Tobias Södergren</dc:creator>
				<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[gmail]]></category>
		<category><![CDATA[problem]]></category>
		<category><![CDATA[safari]]></category>
		<category><![CDATA[workaround]]></category>

		<guid isPermaLink="false">http://blog.jayway.com/?p=9021</guid>
		<description><![CDATA[I've had a really annoying problem where the cursor in Gmail disappears completely when composing mails. Being used to have a visual hint of where the next character is supposed to be placed, I was pleased to find a blog post [1] describing a workaround. The short story of the workaround it is to disable [...]]]></description>
			<content:encoded><![CDATA[<p>I've had a really annoying problem where the cursor in Gmail disappears completely when composing mails. Being used to have a visual hint of where the next character is supposed to be placed, I was pleased to find a blog post [1] describing a workaround.</p>
<p>The short story of the workaround it is to <strong>disable the advanced attachment features</strong> in Gmail. </p>
<p>You can look at the blog post to find out when the problem occur, why it does and why the workaround helps:</p>
<p>[1] <a href="http://db.tidbits.com/article/11495">http://db.tidbits.com/article/11495</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jayway.com/2011/07/07/disappearing-cursor-in-gmail-when-using-safari/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Scripting in Ruby</title>
		<link>http://blog.jayway.com/2010/01/16/scripting-in-ruby/</link>
		<comments>http://blog.jayway.com/2010/01/16/scripting-in-ruby/#comments</comments>
		<pubDate>Sat, 16 Jan 2010 12:54:25 +0000</pubDate>
		<dc:creator>Anders Janmyr</dc:creator>
				<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[gmail]]></category>
		<category><![CDATA[growl]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[scripting]]></category>

		<guid isPermaLink="false">http://blog.jayway.com/?p=4349</guid>
		<description><![CDATA[I just read, or rather skimmed, the book, called Everyday Scripting with Ruby and it is awful. I had high expectations. I was expecting something like Perl for System Administration, where you right away get into hard core Perl scripting. This book is nothing like that! It is a really basic introduction to Ruby, and [...]]]></description>
			<content:encoded><![CDATA[<p>I just read, or rather skimmed, the book, called <em>Everyday Scripting with Ruby</em> and it is awful. I had high expectations. I was expecting something like<br />
<a href="http://www.amazon.com/Perl-System-Administrators-David-Blank-Edelman/dp/1565926099?tag=thtasta-20">Perl for System Administration</a>, where you right away get into hard core Perl scripting. This book is nothing like that! It is a really basic introduction to Ruby, and if you have any experience programming at all, DON'T BUY THIS BOOK.</p>
<p>OK, enough complaining! I am going to do what this book does not do. I am going to show a good way to write scripts in Ruby. If you want to learn more about Ruby, buy<br />
<a href="http://www.amazon.com/Programming-Ruby-1-9-Pragmatic-Programmers/dp/1934356085?tag=thtasta-20">Programming Ruby</a>, <a href="http://www.amazon.com/Well-Grounded-Rubyist-David-Black/dp/1933988657?tag=thtasta-20">The Well-Grounded Rubyist</a> and <a href="http://www.amazon.com/Ruby-Way-Second-Techniques-Programming/dp/0672328844?tag=thtasta-20">The Ruby Way</a>.</p>
<p>Ruby is an excellent language. It is, in my opinion, the best scripting language and it beats both Perl and Python face down. If you are not scripting in Ruby, you are missing out.<br />
Ok, so here is the script.</p>
<h3>sendgmail</h3>
<p>The script is called <strong>sendgmail</strong> and it sends mail via gmail (surprise!).</p>
<p>This is how the command is used.</p>
<pre lang='bash'>
$ sendgmail --help
/usr/local/bin/sendgmail [options] attachments...
Options are ...
    -t, --to TO                      Send email to recipient
    -m, --message MESSAGE            Include the message.
    -s, --subject SUBJECT            Include the subject.
    -v, --verbose                    Log to standard output.
    -V, --version                    Display the program version.
    -h, -H, --help                   Display this help message.
</pre>
<p>And here is the code, liberally sprinkled with comments.</p>
<pre>
<I>#!/usr/bin/env ruby
</I><I># Use the currently configured ruby version
</I>
<I># optparse contains OptionParser, ostruct: OpenStruct and growl Growl
</I><B>require</B> <B>'optparse'</B>
<B>require</B> <B>'ostruct'</B>
<B>require</B> <B>'growl'</B>

<I># This is the name of the script that is called
</I><I># Whatever you name your script will be reflected here.
</I><I># This can be useful if you want to have the same script do many things
</I><I># Create differently named links to the script
</I><I># and use the program name to select behavior.
</I>PROGRAM_NAME = <B>$0</B>
PROGRAM_VERSION = 1.0

<I># Create an OpenStruct to save the options.
</I><I># OpenStruct allows you to use options.my_option instead of
</I><I># option['my_option'] with a normal hash
</I><I># http://ruby-doc.org/stdlib/libdoc/ostruct/rdoc/classes/OpenStruct.html
</I><B>def</B> <B>options
</B>  <B>@options</B> ||= OpenStruct.new
<B>end</B>

<I># This is the options of the program, see OptionParser
</I><I># http://ruby-doc.org/stdlib/libdoc/optparse/rdoc/classes/OptionParser.html
</I><B>def</B> <B>program_options
</B>  [
          <I># The values of the array are,
</I>          <I># [long_option, short_option and parameter, description, code to execute]
</I>          [<B>'--to'</B>, <B>'-t TO'</B>, <B>&quot;Send email to recipient&quot;</B>,
           lambda { |value| options.to = value }
          ],
          [<B>'--message'</B>, <B>'-m MESSAGE'</B>, <B>&quot;Include the message.&quot;</B>,
           lambda { |value| options.message = value }
          ],
          [<B>'--subject'</B>, <B>'-s SUBJECT'</B>, <B>&quot;Include the subject.&quot;</B>,
           lambda { |value| options.subject = value }
          ],
          [<B>'--verbose'</B>, <B>'-v'</B>, <B>&quot;Log to standard output.&quot;</B>,
           lambda { |value| options.verbose = <B>true</B> }
          ],
          [<B>'--version'</B>, <B>'-V'</B>, <B>&quot;Display the program version.&quot;</B>,
           lambda { |value|
             puts <B>&quot;#{program_name}, version #{PROGRAM_VERSION}&quot;</B>
             exit
           }
          ]
  ]
<B>end</B>

option_parser = OptionParser.new <B>do</B> |opts|
  opts.banner = <B>&quot;#{PROGRAM_NAME} [options] attachments...&quot;</B>
  opts.separator <B>&quot;&quot;</B>
  opts.separator <B>&quot;Options are ...&quot;</B>

  <I># Add the command on_tail, to make it appear as the last option in the list.
</I>  opts.on_tail(<B>&quot;-h&quot;</B>, <B>&quot;--help&quot;</B>, <B>&quot;-H&quot;</B>, <B>&quot;Display this help message.&quot;</B>) <B>do</B>
    puts opts
    exit
  <B>end</B>

  program_options.each { |args| opts.on(*args) }
<B>end</B>

<B>begin</B>
  <I># Parse the options and remove them from the ARGV array
</I>  option_parser.parse!
<B>rescue</B> OptionParser::ParseError =&gt; error
  puts error.message
  puts option_parser
  exit
<B>end</B>

<B>unless</B> options.to
  puts <B>'Missing required argument --to or -t'</B>
  puts option_parser
  exit
<B>end</B>

options.subject = <B>'No subject'</B> <B>unless</B> options.subject
options.message = <B>''</B> <B>unless</B> options.message

<I># Concatenate the options into a proper command
</I>command = <B>'sendemail -o tls=yes -s smtp.gmail.com -f from@gmail.com -xu from@gmail.com -xp secret'</B>
command += <B>&quot;-t '#{options.to}' -u '#{options.subject}' -m '#{options.message}' &quot;</B>

<I># Append the filenames with the -a option to send them as attachments
</I><I># Only the non options (the filenames) are left in ARGV
</I><B>unless</B> ARGV.empty?
  command += <B>&quot; -a #{ARGV.join(' ')}&quot;</B>
<B>end</B>

<I># Print the command to screen if using verbose mode.
</I>puts command <B>if</B> options.verbose
system command

Growl.notify <B>&quot;#{options.subject}\n#{options.message}&quot;</B>, :icon =&gt; :jpeg, :title =&gt; <B>&quot;Email sent to #{options.to}&quot;</B>
</pre>
<p>The script requires you to install <strong>sendemail</strong>. It also requires you to install the <strong>growlnotify</strong> command line utility that is distributed with <a href="http://growl.info/">Growl</a> and the gem that uses this utility, also conveniently named <strong>growl</strong>.</p>
<h3>Install required dependencies on OS X</h3>
<pre>
<I># Install sendemail and capabilty to send secure mail, required by Gmail
</I>sudo port install sendemail p5-net-ssleay p5-io-socket-ssl

<I># Install growl command utility from the mounted image
</I>sudo sh /Volumes/Growl-1.2/Extras/growlnotify/install.sh

<I># Install the growl gem
</I>sudo gem install growl
</pre>
<p>That&#8217;s it, a simple script that will allow you to send messages and files through<br />
gmail from the command line.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jayway.com/2010/01/16/scripting-in-ruby/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

