# EmailApi (Email APIs)

## sendEmail

Send email to recipient via the internally provision gateway of the workbench.​

```
EmailApi.sendEmail(appName, email, subject, content,
      template, fromAlias, templateParams)
or

EmailApi.sendEmail(appName, email, subject, content,
      template, fromAlias, templateParams, senderEmail)
or
EmailApi.sendEmail(toEmail, subject, content)
or 
EmailApi.sendEmail(toEmail, template,
      emailParams, subject)
```

parameters:

```
appName:     name of the internal application (string)
email:       email of the sender (string)
subject:     subject of a email (string)
content:     contents (string)
template:    template to be used  (string)
fromAlias:   alias name   (string)
templateParams:   template parameters (dictionary)
senderEmail:      sender email (string)
toEmail:     to email (string)
emailParams : email params (dictionary)
```

Return:

```
A Result object indicating the success or failure of the email sending operation.
```

## sendEmailMarkDownContent

Send email with markdown contents.

```
EmailApi.sendEmailMarkDownContent(mailTo, body, subject)
```

parameters:

```
mailTo:    recipient address (string)
body:      body with markdown (string)
subject:   subject of the email (string)
```

Return:

```
A Result object indicating the success or failure of the email sending operation.
```

## sendEmailUsingFunction

Send email using the function

```
EmailApi.sendEmailUsingFunction(functionName,
      emailParams)
```

parameters:

```
functionName (string)
emailParams (dictionary)
```

Return:

```
boolean
```

## getSubject

Get subject

```
EmailApi.getSubject(templateName, defaultSubject,
      emailParams)
```

parameters:

```
templateName (string)
defaultSubject (string)
emailParams (dictionary)
```

Return:

```
String
```

## getProcessedEmailContentFromTemplate

get processed email content from template

```
EmailApi.getProcessedEmailContentFromTemplate(templateName,
      emailParams)
```

parameters:

```
templateName (string)
emailParams (dictionary)
```

Return:

```
String
```

## emailTemplateExists

check if the email template exits

```
EmailApi.emailTemplateExists(templateName)
```

parameters:

```
templateName (string)
```

Return:

```
boolean
```

## getEmailProps

get email props

```
EmailApi.getEmailProps(templateName)
```

parameters:

```
templateName (string)
```

Return:

```
Dictionary
```

## getServerName

get server name

```
EmailApi.getServerName()
```

parameters:

```
None
```

Return:

```
String
```
