ruby mail help

D

djlewis

I'm trying to send simple messages with attachments. The mail goes
out, but with numerous problems. Any help would be much appreciated.
Thanks. --David.

require 'net/smtp'
require 'tmail'
email = TMail::Mail.new
email.body = '6 Just a body here.'
# email.from = '(e-mail address removed)'
# email.to = '(e-mail address removed)'
email.subject = 'subjectivity 1'
email.date = Time.now
email.mime_version = '1.0'
email.set_content_type 'text', 'plain', {'charset'=>'utf-8'}
email['Content-Disposition'] = 'attachment; filename="testrb.txt"'
#email = [ "Subject: Test 3\n", "\n", "Now is the time again\n" ]
Net::SMTP.start('mail.triadic.com', 587, 'triadic.com',
'(e-mail address removed)', 'password', :login) do |smtp|
smtp.send_message email, '(e-mail address removed)' ,
'(e-mail address removed)'
end

The message goes out fine and, when received, looks like this...
--------------------------------
Date: Sun, 6 Jan 2008 10:05:03 -0800 (PST)
From: "triadic.com" <[email protected]>
To: undisclosed-recipients:;
(MISSING_SUBJECT,SPF_HELO_PASS,SPF_PASS,UNDISC_RECIPS)
6 Just a body here.
--------------------------------
Problems:
* I get two identical copies of the email
* undisclosed recipients -- I don't want that
* subject not present. But when I construct the message with the now
quoted line
{email = [ "Subject: Test 3\n", "\n", "Now is the time again\n" ]
the subject works. Why not with tmail? A dump of the email object
looks fine to me.
* no attachment goes through

Thanks. --David.
 

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,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top