1. Home
  2. Computing & Technology
  3. Ruby

How to Send Email with Ruby

By Amanda & Michael Morin, About.com

3 of 5

Composing the Message

To compose the email messages, you need to know a little bit about email and SMTP. An email message is composed of a number of headers and a body. However, you can get by with the minimum of headers, since the only headers required to make a sensible email messages are From (who is the message from?), To (who is the message to?) and Subject (the subject line of the message). Compose the email message in a string. Since emails are multi-line messages, it's recommended you use a heredoc or the DATA stream, both of which are demonstrated in the example programs.

Explore Ruby
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Ruby
  4. Tasks & Scripts
  5. Composing the Message

©2009 About.com, a part of The New York Times Company.

All rights reserved.