mailfactory 0.5.1 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -254,10 +254,10 @@ class MailFactory
254
254
  if(!file.respond_to?(:stat) and type == nil)
255
255
  attachment[1] = MIME::Types.type_for(file.to_s()).to_s
256
256
  else
257
- attachemnt[1] = type
257
+ attachment[1] = type
258
258
  end
259
259
 
260
- if(file.respond_to?(:stat))
260
+ if(!file.respond_to?(:stat))
261
261
  # Open in rb mode to handle Windows, which mangles binary files opened in a text mode
262
262
  File.open(file.to_s(), "rb") { |fp|
263
263
  attachment[2] = Base64.b64encode(fp.read())
@@ -151,7 +151,23 @@ class TC_MailFactory < Test::Unit::TestCase
151
151
  end
152
152
 
153
153
 
154
- def test_attach
154
+ def test_attach_as
155
+ @mail.to="test@test.com"
156
+ @mail.from="test@othertest.com"
157
+ @mail.subject="This is a test"
158
+ @mail.text = "This is a test message with\na few\n\nlines."
159
+
160
+ @mail.add_attachment_as('testfile.txt', 'newname.txt')
161
+ @mail.add_attachment_as(File.open('testsheet.xls', 'rb'), 'newname.xls', 'application/vnd.ms-excel')
162
+
163
+ if($options['smtpserver'] != nil and $options['to'] != nil and $options['from'] != nil)
164
+ assert_nothing_raised() {
165
+ require('net/smtp')
166
+ Net::SMTP.start($options['smtpserver'], 25, 'mail.from.domain', $options['username'], $options['password'], :cram_md5) { |smtp|
167
+ smtp.send_message(@mail.to_s(), $options['from'], $options['to'])
168
+ }
169
+ }
170
+ end
155
171
  end
156
172
 
157
173
  end
metadata CHANGED
@@ -3,7 +3,7 @@ rubygems_version: 0.8.10
3
3
  specification_version: 1
4
4
  name: mailfactory
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.5.1
6
+ version: 0.5.2
7
7
  date: 2005-06-16
8
8
  summary: MailFactory is a pure-ruby MIME mail generator
9
9
  require_paths: