via Gmail API Integration with Ruby.
Recently, while automating a functional test-case, I met with a requirement where, for every transaction, I had to verify the content of an email sent to users. Coming from a UI automation background, I initially thought of automating the Gmail Web UI using Selenium WebDriver.
However, after more searching, I found that Gmail’s UI is developed in Google Web ToolKit (GWT), which is highly dynamic and generates random IDs to all of the DOM elements in every session. After discovering this, I decided to give up this approach, because it would be very difficult to handle these dynamic IDs in our WebDriver code. I then began looking into alternative approaches.
After more research, I found out that in 2014 Google released their official Gmail APIs, which provide a RESTful interface to both read Gmail mailboxes and send emails. I decided to use this approach because it was much more robust and it allows users to have more control over their Gmail inbox.
This implementation required me to use Ruby, which has specific client bindings for these APIs. To get started with the Ruby bindings, we need to install the official gem developed by the Google team for this command.
via Effectively managing memory at Gmail scale – HTML5 Rocks.
This is an example of Spring E-mail support via the Gmail SMTP Server. The Spring Framework provides a utility library for sending emails. The
org.springframework.mail package contains all classes that provide the basic email support of the Spring Framework. Here we use its basic interface for sending emails, that is the
MailSender interface. We are also making use of the
SimpleMailMessage class, the basic class to create a simple email message. We enrich our example, creating a message with a specified template. Finally, we send an e-mail with an attachment file, using the
JavaMailSender interface and the
Our preferred development environment is Eclipse. We are using Eclipse Juno (4.2) version, along with Maven Integration plugin version 3.1.0. You can download Eclipse from here and Maven Plugin for Eclipse from here. The installation of Maven plugin for Eclipse is out of the scope of this tutorial and will not be discussed. We are also using Spring version 3.2.3 and the JDK 7_u_21.
Let’s begin, Read more>>