ruby to send email attachments

Discussion in 'Ruby' started by rtilley, Apr 2, 2006.

  1. rtilley

    rtilley Guest

    I searched the news group and found a script that sends email with
    attachments. I modified it a bit to loop through an array sending to
    multiple recipients, however, it seems that addresses with a '_' or a
    '-' in them will sometimes produce an error on sending.

    The script is too long to post here. Here is a link to it:
    http://filebox.vt.edu/users/rtilley/public/email.rb

    Would someone look it over to see what I'm doing wrong? I'm relatively
    new to Ruby, so I'm sure I've just done something wrong. Perhaps it's
    how I read the email addresses into an array?

    Also, how would I insert a message-id into emails? Our mail server
    complains when a message comes through without one and inserts one
    itself. No big deal really, it just raises the spam score a tiny bit
    (not that I spam)... these are legit emails.

    Thanks to anyone who can offer help or advice!
    Brad
     
    rtilley, Apr 2, 2006
    #1
    1. Advertising

  2. rtilley

    Park Heesob Guest

    Hi,

    >From: rtilley <>
    >Reply-To:
    >To: (ruby-talk ML)
    >Subject: ruby to send email attachments
    >Date: Sun, 2 Apr 2006 23:23:45 +0900
    >
    >I searched the news group and found a script that sends email with
    >attachments. I modified it a bit to loop through an array sending to
    >multiple recipients, however, it seems that addresses with a '_' or a '-'
    >in them will sometimes produce an error on sending.
    >

    insert this line
    smtp.set_debug_output $stderr
    after the line
    smtp = Net::SMTP.new(@server)
    and examine the debug messages.

    >The script is too long to post here. Here is a link to it:
    >http://filebox.vt.edu/users/rtilley/public/email.rb
    >
    >Would someone look it over to see what I'm doing wrong? I'm relatively new
    >to Ruby, so I'm sure I've just done something wrong. Perhaps it's how I
    >read the email addresses into an array?
    >
    >Also, how would I insert a message-id into emails? Our mail server
    >complains when a message comes through without one and inserts one itself.
    >No big deal really, it just raises the spam score a tiny bit (not that I
    >spam)... these are legit emails.
    >

    insert message-id like this
    wa.write("Message-ID: <000001c656e2$a8217380$0100007f@localhost>\r\n")
    after the line
    wa.write("MIME-Version: 1.0\r\n")

    >Thanks to anyone who can offer help or advice!
    >Brad
    >

    Hope this helps,

    Park Heesob
     
    Park Heesob, Apr 3, 2006
    #2
    1. Advertising

  3. Hi Brad,

    On 4/2/06, rtilley <> wrote:
    > I searched the news group and found a script that sends email with
    > attachments.


    You might want to check out SimpleMail
    (http://simplemail.rubyforge.org/). That's the library I've been
    using to send out scripted emails.

    - Dimitri
     
    Dimitri Aivaliotis, Apr 3, 2006
    #3
    1. Advertising

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. Aleksei Pashin

    Send email message with attachments

    Aleksei Pashin, Oct 12, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    460
    Aleksei Pashin
    Oct 12, 2004
  2. Aleksei Pashin

    Send email message with attachments

    Aleksei Pashin, Oct 12, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    440
    Schalkwi
    Dec 9, 2005
  3. Music Lover
    Replies:
    5
    Views:
    2,000
    Music Lover
    May 12, 2005
  4. Andrew Thompson
    Replies:
    0
    Views:
    520
    Andrew Thompson
    Dec 7, 2006
  5. loominator1970

    Send email with attachments in Ruby

    loominator1970, Sep 3, 2008, in forum: Ruby
    Replies:
    6
    Views:
    236
    Christopher Pickslay
    Sep 21, 2010
Loading...

Share This Page