Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Clean up the examples

Use idiomatic Ruby indentation
  • Loading branch information...
commit 1ded539ab8060f7b3baf2f1366e65d4fd165a4c6 1 parent 1ce9be6
Daniel Schierbeck dasch authored

Showing 1 changed file with 31 additions and 26 deletions. Show diff stats Hide diff stats

  1. +31 26 README.rdoc
57 README.rdoc
Source Rendered
@@ -147,10 +147,10 @@ So, you should be able to just <code>require 'mail'</code> to get started.
147 147 require 'mail'
148 148
149 149 mail = Mail.new do
150   - from 'mikel@test.lindsaar.net'
151   - to 'you@test.lindsaar.net'
  150 + from 'mikel@test.lindsaar.net'
  151 + to 'you@test.lindsaar.net'
152 152 subject 'This is a test email'
153   - body File.read('body.txt')
  153 + body File.read('body.txt')
154 154 end
155 155
156 156 mail.to_s #=> "From: mikel@test.lindsaar.net\r\nTo: you@...
@@ -174,7 +174,7 @@ So, you should be able to just <code>require 'mail'</code> to get started.
174 174 require 'mail'
175 175
176 176 mail = Mail.new do
177   - to 'you@test.lindsaar.net'
  177 + to 'you@test.lindsaar.net'
178 178 body 'Some simple body'
179 179 end
180 180
@@ -190,9 +190,9 @@ give it a unique, random Message-ID along the lines of:
190 190 require 'mail'
191 191
192 192 mail = Mail.new do
193   - to 'you@test.lindsaar.net'
194   - message_id '<ThisIsMyMessageId@some.domain.com>'
195   - body 'Some simple body'
  193 + to 'you@test.lindsaar.net'
  194 + message_id '<ThisIsMyMessageId@some.domain.com>'
  195 + body 'Some simple body'
196 196 end
197 197
198 198 mail.to_s =~ /Message\-ID: <ThisIsMyMessageId@some.domain.com>/ #=> 27
@@ -207,21 +207,21 @@ sendmail or postfix daemon running on on this port, sending email is as
207 207 easy as:
208 208
209 209 Mail.deliver do
210   - from 'me@test.lindsaar.net'
211   - to 'you@test.lindsaar.net'
  210 + from 'me@test.lindsaar.net'
  211 + to 'you@test.lindsaar.net'
212 212 subject 'Here is the image you wanted'
213   - body File.read('body.txt')
  213 + body File.read('body.txt')
214 214 add_file '/full/path/to/somefile.png'
215 215 end
216 216
217 217 or
218 218
219 219 mail = Mail.new do
220   - from 'me@test.lindsaar.net'
221   - to 'you@test.lindsaar.net'
222   - subject 'Here is the image you wanted'
223   - body File.read('body.txt')
224   - add_file {:filename => 'somefile.png', :content => File.read('/somefile.png')}
  220 + from 'me@test.lindsaar.net'
  221 + to 'you@test.lindsaar.net'
  222 + subject 'Here is the image you wanted'
  223 + body File.read('body.txt')
  224 + add_file :filename => 'somefile.png', :content => File.read('/somefile.png')
225 225 end
226 226
227 227 mail.deliver!
@@ -229,11 +229,11 @@ or
229 229 Sending via sendmail can be done like so:
230 230
231 231 mail = Mail.new do
232   - from 'me@test.lindsaar.net'
233   - to 'you@test.lindsaar.net'
234   - subject 'Here is the image you wanted'
235   - body File.read('body.txt')
236   - add_file {:filename => 'somefile.png', :content => File.read('/somefile.png')}
  232 + from 'me@test.lindsaar.net'
  233 + to 'you@test.lindsaar.net'
  234 + subject 'Here is the image you wanted'
  235 + body File.read('body.txt')
  236 + add_file :filename => 'somefile.png', :content => File.read('/somefile.png')
237 237 end
238 238
239 239 mail.delivery_method :sendmail
@@ -330,12 +330,14 @@ simple as possible.... (asking a lot from a mail library)
330 330 require 'mail'
331 331
332 332 mail = Mail.deliver do
333   - to 'nicolas@test.lindsaar.net.au'
334   - from 'Mikel Lindsaar <mikel@test.lindsaar.net.au>'
  333 + to 'nicolas@test.lindsaar.net.au'
  334 + from 'Mikel Lindsaar <mikel@test.lindsaar.net.au>'
335 335 subject 'First multipart email sent with Mail'
  336 +
336 337 text_part do
337 338 body 'This is plain text'
338 339 end
  340 +
339 341 html_part do
340 342 content_type 'text/html; charset=UTF-8'
341 343 body '<h1>This is HTML</h1>'
@@ -393,8 +395,8 @@ an email, not Mail::Messages.
393 395 require 'mail'
394 396
395 397 mail = Mail.new do
396   - to 'nicolas@test.lindsaar.net.au'
397   - from 'Mikel Lindsaar <mikel@test.lindsaar.net.au>'
  398 + to 'nicolas@test.lindsaar.net.au'
  399 + from 'Mikel Lindsaar <mikel@test.lindsaar.net.au>'
398 400 subject 'First multipart email sent with Mail'
399 401 end
400 402
@@ -461,16 +463,19 @@ than mail (this should be rarely needed)
461 463 Of course... Mail will round trip an attachment as well
462 464
463 465 @mail = Mail.new do
464   - to 'nicolas@test.lindsaar.net.au'
465   - from 'Mikel Lindsaar <mikel@test.lindsaar.net.au>'
  466 + to 'nicolas@test.lindsaar.net.au'
  467 + from 'Mikel Lindsaar <mikel@test.lindsaar.net.au>'
466 468 subject 'First multipart email sent with Mail'
  469 +
467 470 text_part do
468 471 body 'Here is the attachment you wanted'
469 472 end
  473 +
470 474 html_part do
471 475 content_type 'text/html; charset=UTF-8'
472 476 body '<h1>Funky Title</h1><p>Here is the attachment you wanted</p>'
473 477 end
  478 +
474 479 add_file '/path/to/myfile.pdf'
475 480 end
476 481

0 comments on commit 1ded539

Please sign in to comment.
Something went wrong with that request. Please try again.