ruby to send email attachments

R

rtilley

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
 
P

Park Heesob

Hi,
From: rtilley <[email protected]>
Reply-To: (e-mail address removed)
To: (e-mail address removed) (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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,979
Messages
2,570,185
Members
46,723
Latest member
TwilaTarde

Latest Threads

Top