x
Loading
 Loading
Hello, Guest | Login | Register

Where Ruby Really Sparkles

Ruby is a concise, fully object-oriented, and powerful programming language. It’s also ideal for building networked applications. Find out why Ruby really connects.

ruby_01

If you’re looking for a simple, elegant way to script access to the Internet, you should probably take a look at Ruby (for an introduction to Ruby see “A Ruby Refresher”). Ruby is concise (like Python), fully object-oriented (like SmallTalk), and powerful (like Perl). In addition, Ruby is a remarkably capable language for building Internet applications. Ruby’s libraries and built-in networking support make networked applications (such as email clients, SOAP servers, and distributed processing) easy to write and easy to maintain and extend. Yeah, take a look at Ruby and learn what its many fans already know: Ruby really connects.

Sending Email via SMTP

Every week, Holden Glova, Pat Eyler, and Phil Thomson submit a Ruby Weekly News (RWN) article to the Ruby Garden Web site (http://www.rubygarden.org). A Ruby script receives the article through email, transforms it from the original XML into HTML and plain text, posts the HTML to the site, and emails the plain text to a mailing list. If there’s a problem (perhaps because the XML is malformed), the script sends the submitter an email with a cryptic summary of the problem.

The script uses the Net::SMTP (Simple Mail Transfer Protocol) library to send email. Listing One shows a part of this script containing the method that sends the email. The method takes three parameters: an email address, a subject, and the body of the message. Because this particular script…

Please log in to view this content.

Not Yet a Member?

Register with LinuxMagazine.com and get free access to the entire archive, including:

  • Hands-on Content
  • White Papers
  • Community Features
  • And more.
Already a Member?
Log in!
Username

Password

Remember me

Forgotten your password?
Forgotten your username?
Read More
  1. Helpful Tools for Software Developers
  2. The Github Hall of Fame
  3. Book'em, Github.
  4. This Week on Github: Stupid Ruby Tricks
  5. A Veritable Scatter Shot!
Follow Linux Magazine
Rackspace