Methods
- attachment_with_custom_header
- cancelled_account
- cc_bcc
- custom_content_type_attributes
- custom_template
- explicitly_multipart_example
- extended_headers
- headers_with_nonalpha_chars
- html_mail
- html_mail_with_underscores
- implicitly_multipart_example
- implicitly_multipart_with_utf8
- iso_charset
- multipart_with_mime_version
- multipart_with_utf8_subject
- nested_multipart
- receive
- signed_up
- unencoded_subject
- unnamed_attachment
- utf8_body
- various_newlines
- various_newlines_multipart
Attributes
| [RW] | received_body |
Public Instance methods
[ show source ]
# File test/mail_service_test.rb, line 230
230: def attachment_with_custom_header(recipient)
231: recipients recipient
232: subject "custom header in attachment"
233: from "test@example.com"
234: content_type "multipart/related"
235: part :content_type => "text/html", :body => 'yo'
236: attachment :content_type => "image/jpeg",:filename => "test.jpeg", :body => "i am not a real picture", :headers => { 'Content-ID' => '<test@test.com>' }
237: end
[ show source ]
# File test/mail_service_test.rb, line 50
50: def cancelled_account(recipient)
51: self.recipients = recipient
52: self.subject = "[Cancelled] Goodbye #{recipient}"
53: self.from = "system@loudthinking.com"
54: self.sent_on = Time.local(2004, 12, 12)
55: self.body = "Goodbye, Mr. #{recipient}"
56: end
[ show source ]
# File test/mail_service_test.rb, line 58
58: def cc_bcc(recipient)
59: recipients recipient
60: subject "testing bcc/cc"
61: from "system@loudthinking.com"
62: sent_on Time.local(2004, 12, 12)
63: cc "nobody@loudthinking.com"
64: bcc "root@loudthinking.com"
65: body "Nothing to see here."
66: end
[ show source ]
# File test/mail_service_test.rb, line 257
257: def custom_content_type_attributes
258: recipients "no.one@nowhere.test"
259: subject "custom content types"
260: from "some.one@somewhere.test"
261: content_type "text/plain; format=flowed"
262: body "testing"
263: end
[ show source ]
# File test/mail_service_test.rb, line 191
191: def custom_template(recipient)
192: recipients recipient
193: subject "[Signed up] Welcome #{recipient}"
194: from "system@loudthinking.com"
195: sent_on Time.local(2004, 12, 12)
196: template "signed_up"
197:
198: body["recipient"] = recipient
199: end
[ show source ]
# File test/mail_service_test.rb, line 143
143: def explicitly_multipart_example(recipient, ct=nil)
144: recipients recipient
145: subject "multipart example"
146: from "test@example.com"
147: sent_on Time.local(2004, 12, 12)
148: body "plain text default"
149: content_type ct if ct
150:
151: part "text/html" do |p|
152: p.charset = "iso-8859-1"
153: p.body = "blah"
154: end
155:
156: attachment :content_type => "image/jpeg", :filename => "foo.jpg",
157: :body => "123456789"
158: end
[ show source ]
# File test/mail_service_test.rb, line 89
89: def extended_headers(recipient)
90: @recipients = recipient
91: @subject = "testing extended headers"
92: @from = "Grytøyr <stian1@example.net>"
93: @sent_on = Time.local 2004, 12, 12
94: @cc = "Grytøyr <stian2@example.net>"
95: @bcc = "Grytøyr <stian3@example.net>"
96: @body = "Nothing to see here."
97: @charset = "iso-8859-1"
98: end
[ show source ]
# File test/mail_service_test.rb, line 248
248: def headers_with_nonalpha_chars(recipient)
249: recipients recipient
250: subject "nonalpha chars"
251: from "One: Two <test@example.com>"
252: cc "Three: Four <test@example.com>"
253: bcc "Five: Six <test@example.com>"
254: body "testing"
255: end
[ show source ]
# File test/mail_service_test.rb, line 178
178: def html_mail(recipient)
179: recipients recipient
180: subject "html mail"
181: from "test@example.com"
182: body "<em>Emphasize</em> <strong>this</strong>"
183: content_type "text/html"
184: end
[ show source ]
# File test/mail_service_test.rb, line 186
186: def html_mail_with_underscores(recipient)
187: subject "html mail with underscores"
188: body %{<a href="http://google.com" target="_blank">_Google</a>}
189: end
[ show source ]
# File test/mail_service_test.rb, line 160
160: def implicitly_multipart_example(recipient, cs = nil, order = nil)
161: @recipients = recipient
162: @subject = "multipart example"
163: @from = "test@example.com"
164: @sent_on = Time.local 2004, 12, 12
165: @body = { "recipient" => recipient }
166: @charset = cs if cs
167: @implicit_parts_order = order if order
168: end
[ show source ]
# File test/mail_service_test.rb, line 170
170: def implicitly_multipart_with_utf8
171: recipients "no.one@nowhere.test"
172: subject "Foo áëô îü"
173: from "some.one@somewhere.test"
174: template "implicitly_multipart_example"
175: body ({ "recipient" => "no.one@nowhere.test" })
176: end
[ show source ]
# File test/mail_service_test.rb, line 68
68: def iso_charset(recipient)
69: @recipients = recipient
70: @subject = "testing isø charsets"
71: @from = "system@loudthinking.com"
72: @sent_on = Time.local 2004, 12, 12
73: @cc = "nobody@loudthinking.com"
74: @bcc = "root@loudthinking.com"
75: @body = "Nothing to see here."
76: @charset = "iso-8859-1"
77: end
[ show source ]
# File test/mail_service_test.rb, line 111
111: def multipart_with_mime_version(recipient)
112: recipients recipient
113: subject "multipart with mime_version"
114: from "test@example.com"
115: sent_on Time.local(2004, 12, 12)
116: mime_version "1.1"
117: content_type "multipart/alternative"
118:
119: part "text/plain" do |p|
120: p.body = "blah"
121: end
122:
123: part "text/html" do |p|
124: p.body = "<b>blah</b>"
125: end
126: end
[ show source ]
# File test/mail_service_test.rb, line 128
128: def multipart_with_utf8_subject(recipient)
129: recipients recipient
130: subject "Foo áëô îü"
131: from "test@example.com"
132: charset "utf-8"
133:
134: part "text/plain" do |p|
135: p.body = "blah"
136: end
137:
138: part "text/html" do |p|
139: p.body = "<b>blah</b>"
140: end
141: end
[ show source ]
# File test/mail_service_test.rb, line 218
218: def nested_multipart(recipient)
219: recipients recipient
220: subject "nested multipart"
221: from "test@example.com"
222: content_type "multipart/mixed"
223: part :content_type => "multipart/alternative", :content_disposition => "inline" do |p|
224: p.part :content_type => "text/plain", :body => "test text\nline #2"
225: p.part :content_type => "text/html", :body => "<b>test</b> HTML<br/>\nline #2"
226: end
227: attachment :content_type => "application/octet-stream",:filename => "test.txt", :body => "test abcdefghijklmnopqstuvwxyz"
228: end
[ show source ]
# File test/mail_service_test.rb, line 269
269: def receive(mail)
270: self.class.received_body = mail.body
271: end
[ show source ]
# File test/mail_service_test.rb, line 42
42: def signed_up(recipient)
43: @recipients = recipient
44: @subject = "[Signed up] Welcome #{recipient}"
45: @from = "system@loudthinking.com"
46: @sent_on = Time.local(2004, 12, 12)
47: @body["recipient"] = recipient
48: end
[ show source ]
# File test/mail_service_test.rb, line 79
79: def unencoded_subject(recipient)
80: @recipients = recipient
81: @subject = "testing unencoded subject"
82: @from = "system@loudthinking.com"
83: @sent_on = Time.local 2004, 12, 12
84: @cc = "nobody@loudthinking.com"
85: @bcc = "root@loudthinking.com"
86: @body = "Nothing to see here."
87: end
[ show source ]
# File test/mail_service_test.rb, line 239
239: def unnamed_attachment(recipient)
240: recipients recipient
241: subject "nested multipart"
242: from "test@example.com"
243: content_type "multipart/mixed"
244: part :content_type => "text/plain", :body => "hullo"
245: attachment :content_type => "application/octet-stream", :body => "test abcdefghijklmnopqstuvwxyz"
246: end
[ show source ]
# File test/mail_service_test.rb, line 100
100: def utf8_body(recipient)
101: @recipients = recipient
102: @subject = "testing utf-8 body"
103: @from = "Foo áëô îü <extended@example.net>"
104: @sent_on = Time.local 2004, 12, 12
105: @cc = "Foo áëô îü <extended@example.net>"
106: @bcc = "Foo áëô îü <extended@example.net>"
107: @body = "åœö blah"
108: @charset = "utf-8"
109: end
[ show source ]
# File test/mail_service_test.rb, line 201
201: def various_newlines(recipient)
202: recipients recipient
203: subject "various newlines"
204: from "test@example.com"
205: body "line #1\nline #2\rline #3\r\nline #4\r\r" +
206: "line #5\n\nline#6\r\n\r\nline #7"
207: end
[ show source ]
# File test/mail_service_test.rb, line 209
209: def various_newlines_multipart(recipient)
210: recipients recipient
211: subject "various newlines multipart"
212: from "test@example.com"
213: content_type "multipart/alternative"
214: part :content_type => "text/plain", :body => "line #1\nline #2\rline #3\r\nline #4\r\r"
215: part :content_type => "text/html", :body => "<p>line #1</p>\n<p>line #2</p>\r<p>line #3</p>\r\n<p>line #4</p>\r\r"
216: end