Get-EmailMessage
  • 1 Minute to read
  • Dark
    Light
  • PDF

Get-EmailMessage

  • Dark
    Light
  • PDF

Article summary

Summary

Retrieves an existing email message.

Get-EmailMessage
    -Id

Returns an email message object.

Parameters

Parameter

Type

Required?

Notes

Id

Int32

Yes

The email message id.

Examples

Get an existing email message

This example retrieves a specific email message and outputs it as JSON.

# Get an existing email message
$emailMessage = Get-EmailMessage -Id 1

# Convert the email message from a PowerShell object to a JSON object so we can observe the available properties
Write-Output $emailMessage | ConvertTo-Json -Depth 10
{
  "EmailMessageId": 1,
  "ExternalMessageId": "4mhoD3UITUCNiXKpCMYBIQ",
  "Direction": "Outbound",
  "Status": "Sent",
  "To": "jdough@agilityblue.com",
  "Cc": null,
  "Bcc": null,
  "FromAddress": "no-one@nowhere.com",
  "FromName": "Max Miller",
  "Subject": "Email Test",
  "Date": "2020-10-14T13:07:38.9595745+00:00",
  "Body": "<p>Did you try turning it off and then back on, first?</p><p>Thanks,<br />Support</p>",
  "HasAttachments": false,
  "ThreadId": null,
  "Size": 72,
  "IsDeleted": false,
  "CreatedOn": "2020-10-14T13:07:39.0957467+00:00",
  "CreatedBy": null,
  "CreatedByFullName": "Max Miller",
  "CreatedById": "510e109b-6ff5-4442-9670-cd5e3cd82a7a",
  "SentById": "510e109b-6ff5-4442-9670-cd5e3cd82a7a",
  "SentOn": "2020-10-14T13:08:14.4514785+00:00",
  "SentBy": null,
  "SentByFullName": "Max Miller",
  "LastUpdatedById": "510e109b-6ff5-4442-9670-cd5e3cd82a7a",
  "LastUpdatedOn": "2020-10-14T13:08:14.4681775+00:00",
  "LastUpdatedBy": null,
  "LastUpdatedByFullName": "Max Miller",
  "AssociatedContacts": [
    {
      "EmailMessageContactId": 1,
      "EmailMessageId": 1,
      "EmailMessage": null,
      "ContactId": 1,
      "ContactFullName": "John Dough",
      "ContactEmailAddress": "jdough@agilityblue.com",
      "ContactNameAndEmailAddress": "John Dough <jdough@agilityblue.com>",
      "Contact": null,
      "RelationshipTypeId": 1,
      "RelationshipTypeName": "To",
      "RelationshipType": null
    }
  ],
  "Attachments": [],
  "History": []
}