# Sending email using net/smtp

**URL:** <https://www.ruby-forum.com/t/sending-email-using-net-smtp/112367>\
**Category:** Ruby\
**Created:** [August 17, 2007, 11:48pm UTC](https://www.ruby-forum.com/t/sending-email-using-net-smtp/112367 "2007-08-17T23:48:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mobileamusement](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/59ef9b/32.png) [@mobileamusement](https://www.ruby-forum.com/u/mobileamusement)\
**Post date:** [August 17, 2007, 11:48pm UTC](https://www.ruby-forum.com/t/sending-email-using-net-smtp/112367/1 "2007-08-17T23:48:49Z")

</div>

Dear Ruby list

I have been trying to write an auto-mailing program. And I’ve  
succeeded! Almost… ☹

I want to send to multiple email addresses in the to field, but it  
seems no matter how I write it doesn’t work. Places I have read say  
that you can have multiple to addresses by putting in a comma and a  
newline and giving the next entry a single space at the beginning. It  
still doesn’t seem to work ☹ I have the following code to compose  
the email:

email =  
%q{From: removed\_email\_address@domain.invalid  
To: removed\_email\_address@domain.invalid,  
removed\_email\_address@domain.invalid  
Subject: This is a test email

This is the body of the email message  
}

If I run the program to send this email with a single address for To:  
it works flawlessly. However, no matter how I try to give it more  
than one email address it either fails with an error, or if it is  
successful in sending the email never arrives. Which obviously means  
my formatting is wrong. Help would be very much appreciated!

Thank you in advance.

Regards

Gabriel

---

<div class="post-metadata">

**Author:** ![mobileamusement](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/59ef9b/32.png) [@mobileamusement](https://www.ruby-forum.com/u/mobileamusement)\
**Post date:** [August 18, 2007, 1:42am UTC](https://www.ruby-forum.com/t/sending-email-using-net-smtp/112367/2 "2007-08-18T01:42:59Z")

</div>

Well that just goes to show. I spent two days knocking my head  
against a wall with this. The solution - RTFM!! Doh! All I had to do  
was put the addresses in an array. D’oh.
