Zum Hauptinhalt springen

EwsMailBuilder

Class for sending mails through EWS

context.enableModules();
const { EwsMailBuilder } = require("ou.sp.ews.EwsMailBuilder");

new EwsMailBuilder()
.from("sender@example.org")
.body("Dies ist der E-Mail Body Context")
.to("recipient@example.org")
.cc("optional_cc_recipient@example.org")
.attachment({
name: "mypdf.pdf",
content_type: "application/pdf",
file_path: "D:\\mypdf.pdf"
})
.send(ewsService);

Constructors

Constructor

new EwsMailBuilder(): EwsMailBuilder

Returns

EwsMailBuilder

Methods

from()

from(from, mailboxType?, routingType?): this

Parameters

from

string

mail address for sender

mailboxType?

MailboxTypes

mailboxType, default Mailbox

routingType?

RoutingTypes

routingType, default SMTP

Returns

this

this element for chaining


body()

body(body, bodyType?): this

Parameters

body

string

the given body

bodyType?

BodyTypes

the given body type, text or html

Returns

this

this element for chaining


subject()

subject(subject): this

Parameters

subject

string

the given subject

Returns

this

this element for chaining


to()

to(to, mailboxType?, routingType?): this

Parameters

to

string

mail address for recipient

mailboxType?

MailboxTypes

mailboxType, default Mailbox

routingType?

RoutingTypes

routingType, default SMTP

Returns

this

this element for chaining


cc()

cc(cc, mailboxType?, routingType?): this

Parameters

cc

string

mail address for copycat

mailboxType?

MailboxTypes

mailboxType, default Mailbox

routingType?

RoutingTypes

routingType, default SMTP

Returns

this

this element for chaining


disposition()

disposition(dispositionType): this

Parameters

dispositionType

MessageDispositions

the disposition type

Returns

this

this element for chaining

See

MessageDispositions


attachment()

attachment(attachment): this

create an attachment in the ews service

Parameters

attachment

AttachmentData

the attachment object

Returns

this

this element for chaining


send()

send(customEwsService?): void

sends the mail by using the provided ews service instance. If no service provided, a new service will be instanced using attributes $ExchangeOnlineTenant $ExchangeOnlineClientId $ExchangeOnlineClientSecret from the current principal.

Parameters

customEwsService?

Service

Optional ews service instance to use

Returns

void