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

ParameterTypeRequired?Notes
IdInt32YesThe 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": "support@agilityblue.com",
  "Cc": null,
  "Bcc": null,
  "FromAddress": "no-one@nowhere.com",
  "FromName": "Service Account",
  "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": "Service Account",
  "CreatedById": "410e109b-6ff5-4442-9670-cd5e3cd82a7f",
  "SentById": "410e109b-6ff5-4442-9670-cd5e3cd82a7f",
  "SentOn": "2020-10-14T13:08:14.4514785+00:00",
  "SentBy": null,
  "SentByFullName": "Service Account",
  "LastUpdatedById": "410e109b-6ff5-4442-9670-cd5e3cd82a7f",
  "LastUpdatedOn": "2020-10-14T13:08:14.4681775+00:00",
  "LastUpdatedBy": null,
  "LastUpdatedByFullName": "Service Account",
  "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": []
}