Skip to content

Account Object


Overview

The account object is the connection between the nlsMailer library and your specific email service API. Currently supporting Mailgun and MS Graph API, the account object holds your API Key, API Url, etc. When creating an item, the library checks what type of account you have to determine the correct object to return.

Example

The following code example shows how to create two accounts and move between them when sending an email

vba
Dim MailerApp As nlsMailer.Application
Set MailerApp = New nlsMailer.Application

Dim accOne As nlsMailer.Account
Dim accTwo As nlsMailer.Account

Set accOne = MailerApp.Accounts.Add SMTPAddress:="testOne@example.com", _
                                    DisplayName:="Person 1", _
                                    ApiKey:="api-key-0123456789", _
                                    ApiUrl:="https://apiUrlOne.com", _
                                    AccountType:=olMailgun
Set accTwo = nlsMailer.Accounts.Add SMTPAddress:="testTwo@example.com", _
                                    DisplayName:="Person 2", _
                                    ApiKey:="api-key-0123456789", _
                                    ApiUrl:="https://apiUrlTwo.com", _
                                    AccountType:=olMailgun

With MailerApp.CreateItem(olMailItem)
    .Subject = "Creating Accounts"
    .BodyFormat = olFormatHTML
    .HTMLBody = "<p>Here is how to change accounts.</p>
    .Recipients.Add "recipient@example.com"
    Set .SendUsingAccount = accTwo
    .Send
End With

Properties

Name Type
AccountType OlAccountType
ApiKey String
ApiUrl String
Class OlObjectClass
ClientId String
ClientSecret String
DisplayName String
Encrypted String
Parent Accounts
SMTPAddress String
TenantId String