# Ruby mail help

**URL:** <https://www.ruby-forum.com/t/ruby-mail-help/125180>\
**Category:** Ruby\
**Created:** [January 6, 2008, 7:20pm UTC](https://www.ruby-forum.com/t/ruby-mail-help/125180 "2008-01-06T19:20:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![djlewis](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/7bcc69/32.png) [@djlewis](https://www.ruby-forum.com/u/djlewis)\
**Post date:** [January 6, 2008, 7:20pm UTC](https://www.ruby-forum.com/t/ruby-mail-help/125180/1 "2008-01-06T19:20:25Z")

</div>

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 = ‘removed\_email\_address@domain.invalid’

# email.to = ‘removed\_email\_address@domain.invalid’

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](http://mail.triadic.com)’, 587, ‘[triadic.com](http://triadic.com)’,  
‘removed\_email\_address@domain.invalid’, ‘password’, :login) do |smtp|  
smtp.send\_message email, ‘removed\_email\_address@domain.invalid’ ,  
‘removed\_email\_address@domain.invalid’  
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](http://triadic.com)” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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.
