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