Sending email using net/smtp

Discussion in 'Ruby' started by Gabriel Dragffy, Aug 17, 2007.

  1. 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:
    To: ,

    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
     
    Gabriel Dragffy, Aug 17, 2007
    #1
    1. Advertisements

  2. 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.
    On 17 Aug 2007, at 22:48, Gabriel Dragffy wrote:

    > 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:
    > To: ,
    >
    > 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
    >
     
    Gabriel Dragffy, Aug 18, 2007
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. bivin
    Replies:
    1
    Views:
    884
    venkat
    Jun 27, 2003
  2. Ersin Gençtürk

    sending inline image in email via .net smtp mail

    Ersin Gençtürk, Feb 28, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    4,142
    bruce barker
    Feb 28, 2005
  3. Replies:
    3
    Views:
    1,341
    Roedy Green
    Jan 24, 2006
  4. Alex Hunsley
    Replies:
    4
    Views:
    4,537
    Tim Williams (gmail)
    Jun 29, 2004
  5. Replies:
    3
    Views:
    2,002
    Cowboy \(Gregory A. Beamer\)
    Sep 30, 2008
  6. Kamil
    Replies:
    2
    Views:
    445
    Kamil
    Sep 22, 2005
  7. Bob
    Replies:
    5
    Views:
    543
    A. Sinan Unur
    Oct 3, 2005
  8. still just me

    Sending HTML (MIME) email with Net::SMTP ?

    still just me, Jan 10, 2008, in forum: Perl Misc
    Replies:
    3
    Views:
    292
    still just me
    Jan 10, 2008
Loading...