Skip to content

Commit 13988d5

Browse files
ey-mailosaurjm-mailosaur
authored andcommitted
Added CC property to message option models
Including Create, Forward and Reply
1 parent 6bd6f15 commit 13988d5

File tree

2 files changed

+63
-1
lines changed

2 files changed

+63
-1
lines changed

src/mailosaurCommands.d.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,10 @@ export interface MessageCreateOptions {
335335
* The email address to which the email will be sent. Must be a verified email address.
336336
*/
337337
to?: string;
338+
/**
339+
* The email address to which the email will be CC'd. Must be a verified email address.
340+
*/
341+
cc?: string;
338342
/**
339343
* Allows for the partial override of the message's 'from' address. This **must** be an address ending with `YOUR_SERVER.mailosaur.net`, such as `my-emails@a1bcdef2.mailosaur.net`.
340344
*/
@@ -369,6 +373,10 @@ export interface MessageForwardOptions {
369373
* The email address to which the email will be sent. Must be a verified email address.
370374
*/
371375
to: string;
376+
/**
377+
* The email address to which the email will be CC'd. Must be a verified email address.
378+
*/
379+
cc?: string;
372380
/**
373381
* Any plain text to include when forwarding the message. Note that only text or html can be supplied, not both.
374382
*/
@@ -383,6 +391,10 @@ export interface MessageForwardOptions {
383391
* Options to use when replying to a message.
384392
*/
385393
export interface MessageReplyOptions {
394+
/**
395+
* The email address to which the email will be CC'd. Must be a verified email address.
396+
*/
397+
cc?: string;
386398
/**
387399
* Any additional plain text content to include in the reply. Note that only text or html can be supplied, not both.
388400
*/

test/react-app/cypress/e2e/messages.cy.js

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ const validateEmail = (email) => {
9090
// validateText(email);
9191
expect(email.metadata.ehlo).to.be.null;
9292
expect(email.metadata.mailFrom).to.be.null;
93-
expect(email.metadata.rcptTo).to.have.lengthOf(1);
93+
expect(email.to).to.have.lengthOf(1);
9494
};
9595

9696
const validateEmailSummary = (email) => {
@@ -411,6 +411,24 @@ describe('Mailosaur message commands', () => {
411411
});
412412
});
413413

414+
it('should send with HTML content to a CC recipient', (done) => {
415+
const subject = 'CC Message';
416+
const ccRecipient = `someoneelse@${verifiedDomain}`;
417+
cy.mailosaurCreateMessage(server, {
418+
to: `anything@${verifiedDomain}`,
419+
cc: ccRecipient,
420+
send: true,
421+
subject,
422+
html: '<p>This is a new email with a CC recipient.</p>',
423+
}).then((message) => {
424+
expect(message.id).to.be.ok;
425+
expect(message.subject).to.equal(subject);
426+
expect(message.cc.length).to.equal(1);
427+
expect(message.cc[0].email).to.equal(ccRecipient);
428+
done();
429+
});
430+
});
431+
414432
it('should send with attachment', (done) => {
415433
const subject = 'New message with attachment';
416434

@@ -467,6 +485,23 @@ describe('Mailosaur message commands', () => {
467485
done();
468486
});
469487
});
488+
489+
it('should forward with HTML content to a CC recipient', (done) => {
490+
const targetEmailId = emails[0].id;
491+
const body = '<p>Forwarded <strong>HTML</strong> message with CC a recipient.</p>';
492+
const ccRecipient = `someoneelse@${verifiedDomain}`;
493+
cy.mailosaurForwardMessage(targetEmailId, {
494+
to: `forwardcc@${verifiedDomain}`,
495+
html: body,
496+
cc: ccRecipient,
497+
}).then((message) => {
498+
expect(message.id).to.be.ok;
499+
expect(message.html.body).to.contain(body);
500+
expect(message.cc.length).to.equal(1);
501+
expect(message.cc[0].email).to.equal(ccRecipient);
502+
done();
503+
});
504+
});
470505
});
471506

472507
// TODO - Tested in Node.js client for now due to way emails are created in Cypress plugin tests
@@ -495,6 +530,21 @@ describe('Mailosaur message commands', () => {
495530
});
496531
});
497532

533+
xit('should reply with HTML content with a CC recipient', (done) => {
534+
const targetEmailId = emails[0].id;
535+
const body = '<p>Reply <strong>HTML</strong> message.</p>';
536+
const ccRecipient = `someoneelse@${verifiedDomain}`;
537+
cy.mailosaurReplyToMessage(targetEmailId, {
538+
html: body,
539+
}).then((message) => {
540+
expect(message.id).to.be.ok;
541+
expect(message.html.body).to.contain(body);
542+
expect(message.cc.length).to.equal(1);
543+
expect(message.cc[0].email).to.equal(ccRecipient);
544+
done();
545+
});
546+
});
547+
498548
xit('should reply with attachment', (done) => {
499549
const targetEmailId = emails[0].id;
500550
const body = '<p>Reply <strong>HTML</strong> message.</p>';

0 commit comments

Comments
 (0)