@@ -264,6 +264,24 @@ def startup
264
264
assert_equal ( subject , message . subject )
265
265
end
266
266
267
+ should 'send with CC recipient' do
268
+ omit_if ( @@verified_domain . nil? )
269
+ subject = 'CC message'
270
+ cc_recipient = 'someoneelse@%s' % [ @@verified_domain ]
271
+ options = Mailosaur ::Models ::MessageCreateOptions . new ( )
272
+ options . to = 'anything@%s' % [ @@verified_domain ]
273
+ options . cc = cc_recipient
274
+ options . send = true
275
+ options . subject = subject
276
+ options . html = '<p>This is a new email.</p>'
277
+ message = @@client . messages . create ( @@server , options )
278
+
279
+ assert_not_nil ( message . id )
280
+ assert_equal ( subject , message . subject )
281
+ assert_equal ( 1 , message . cc . count )
282
+ assert_equal ( cc_recipient , message . cc [ 0 ] . email )
283
+ end
284
+
267
285
should 'send with attachment' do
268
286
omit_if ( @@verified_domain . nil? )
269
287
@@ -317,15 +335,32 @@ def startup
317
335
assert_not_nil ( message . id )
318
336
assert_true ( message . html . body . include? ( body ) )
319
337
end
338
+
339
+ should 'forward with CC recipient' do
340
+ omit_if ( @@verified_domain . nil? )
341
+ target_email = @@emails [ 0 ]
342
+ body = '<p>Forwarded <strong>HTML</strong> message.</p>'
343
+ cc_recipient = 'someoneelse@%s' % [ @@verified_domain ]
344
+
345
+ options = Mailosaur ::Models ::MessageForwardOptions . new ( )
346
+ options . to = 'forwardcc@%s' % [ @@verified_domain ]
347
+ options . cc = cc_recipient
348
+ options . html = body
349
+ message = @@client . messages . forward ( target_email . id , options )
350
+
351
+ assert_not_nil ( message . id )
352
+ assert_true ( message . html . body . include? ( body ) )
353
+ assert_equal ( 1 , message . cc . count )
354
+ assert_equal ( cc_recipient , message . cc [ 0 ] . email )
355
+ end
320
356
end
321
357
322
358
context 'reply' do
323
359
should 'reply with text content' do
324
360
omit_if ( @@verified_domain . nil? )
325
361
target_email = @@emails [ 0 ]
326
362
body = 'Reply message'
327
- options = Mailosaur ::Models ::MessageForwardOptions . new ( )
328
- options . to = 'anything@%s' % [ @@verified_domain ]
363
+ options = Mailosaur ::Models ::MessageReplyOptions . new ( )
329
364
options . text = body
330
365
message = @@client . messages . reply ( target_email . id , options )
331
366
assert_not_nil ( message . id )
@@ -336,14 +371,30 @@ def startup
336
371
omit_if ( @@verified_domain . nil? )
337
372
target_email = @@emails [ 0 ]
338
373
body = '<p>Reply <strong>HTML</strong> message.</p>'
339
- options = Mailosaur ::Models ::MessageForwardOptions . new ( )
340
- options . to = 'anything@%s' % [ @@verified_domain ]
374
+ options = Mailosaur ::Models ::MessageReplyOptions . new ( )
341
375
options . html = body
342
376
message = @@client . messages . reply ( target_email . id , options )
343
377
assert_not_nil ( message . id )
344
378
assert_true ( message . html . body . include? ( body ) )
345
379
end
346
380
381
+ should 'reply with CC recipient' do
382
+ omit_if ( @@verified_domain . nil? )
383
+ target_email = @@emails [ 0 ]
384
+ body = '<p>Reply <strong>HTML</strong> message.</p>'
385
+ cc_recipient = 'someoneelse@%s' % [ @@verified_domain ]
386
+
387
+ options = Mailosaur ::Models ::MessageReplyOptions . new ( )
388
+ options . cc = cc_recipient
389
+ options . html = body
390
+ message = @@client . messages . reply ( target_email . id , options )
391
+
392
+ assert_not_nil ( message . id )
393
+ assert_true ( message . html . body . include? ( body ) )
394
+ assert_equal ( 1 , message . cc . count )
395
+ assert_equal ( cc_recipient , message . cc [ 0 ] . email )
396
+ end
397
+
347
398
should 'reply with attachment' do
348
399
omit_if ( @@verified_domain . nil? )
349
400
target_email = @@emails [ 0 ]
0 commit comments