POST v1/Emails/SendEmailV2

Simplified version of Send Email. Sends an email for the specified contact with an optional policy association. Sender selection is driven by UseSystemEmailFrom and EmailUserAccountId, in this order of precedence: (1) UseSystemEmailFrom = true: sent from the QQCatalyst system address, and EmailUserAccountId is ignored. (2) UseSystemEmailFrom = false and EmailUserAccountId greater than 0: sent from that specific account (validated; the user's default is not used). (3) UseSystemEmailFrom = false and EmailUserAccountId omitted or 0: sent from the current user's default email account (an error is returned when no valid default exists).

Request Information

URI Parameters

None.

Body Parameters

Email send request. When PolicyId is provided the email is scoped to that policy; omit or set to null for contact-level emails. See the summary above for how UseSystemEmailFrom and EmailUserAccountId determine the sender.

SendEmailRequestDTO
NameDescriptionTypeAdditional information
ContactId

Id of the contact the email is being sent for.

integer

None.

PolicyId

Id of the policy to associate with this email. When provided, the email is scoped to the policy. Omit or pass null for contact-level emails.

integer

None.

EmailUserAccountId

Id of the EmailUserAccount to send from. Sender selection depends on this field together with UseSystemEmailFrom. (1) Provided (greater than 0) and UseSystemEmailFrom = false: the email is sent from this specific account, which is validated (must exist and be valid), and the user's default account is not used. (2) Omitted or 0, and UseSystemEmailFrom = false: the email is sent from the current user's default email account, and an error is returned if the user has no default account or it is not valid. (3) UseSystemEmailFrom = true: this field is ignored and the email is sent from the QQCatalyst system address.

integer

None.

ToEmails

Comma-separated list of recipient email addresses.

string

None.

CcEmails

Comma-separated list of CC email addresses.

string

None.

BccEmails

Comma-separated list of BCC email addresses.

string

None.

Subject

Subject line of the email.

string

None.

Body

HTML body of the email. Literal @@ sequences are converted to @ before sending.

string

None.

ExcludeEmailSignature

Controls whether the sending employee's saved email signature is appended to the body. When false (default) the employee's email signature is appended after the body. When true the signature is not appended (use when the caller already includes its own signature in the Body). Has no effect when the employee has no configured signature.

boolean

None.

Description

Internal description stored with the resulting document record.

string

None.

EmailSource

Source tag stored with the resulting document record. Defaults to "API" when not supplied.

string

None.

UseSendGridApi

When true, the email is sent via SendGrid instead of SMTP. When false (default), the email is sent via SMTP.

boolean

None.

UseSystemEmailFrom

Controls whether the email is sent from the QQCatalyst system address. This field takes priority over EmailUserAccountId. When true, the email is sent from the QQCatalyst system address and EmailUserAccountId is ignored (whether or not it is supplied). When false (default) with EmailUserAccountId greater than 0, the email is sent from that specific user account. When false (default) with EmailUserAccountId omitted or 0, the email is sent from the current user's default email account (an error is returned if there is no valid default).

boolean

None.

Attachments

File and image attachments to include. Each entry pairs a file ID with its display name. Example: [{"FileId": 1, "FileName": "policy.pdf"}, {"FileId": 2, "FileName": "form.pdf"}]

Collection of EmailFileAttachmentDTO

None.

AttachAcordList

ACORD form attachments to include.

Collection of EmailAcordAttachDTO

None.

Request Formats

application/json, text/json

Sample:
{
  "ContactId": 1,
  "PolicyId": 1,
  "EmailUserAccountId": 2,
  "ToEmails": "sample string 3",
  "CcEmails": "sample string 4",
  "BccEmails": "sample string 5",
  "Subject": "sample string 6",
  "Body": "sample string 7",
  "ExcludeEmailSignature": true,
  "Description": "sample string 9",
  "EmailSource": "sample string 10",
  "UseSendGridApi": true,
  "UseSystemEmailFrom": true,
  "Attachments": [
    {
      "FileId": 1,
      "FileName": "sample string 2"
    },
    {
      "FileId": 1,
      "FileName": "sample string 2"
    }
  ],
  "AttachAcordList": [
    {
      "ID": 1,
      "AcordNameAsSent": "sample string 2",
      "FromAcordEditor": true
    },
    {
      "ID": 1,
      "AcordNameAsSent": "sample string 2",
      "FromAcordEditor": true
    }
  ]
}

application/x-www-form-urlencoded

Sample:

Failed to generate the sample for media type 'application/x-www-form-urlencoded'. Cannot use formatter 'JQueryMvcFormUrlEncodedFormatter' to write type 'SendEmailRequestDTO'.

application/xml, text/xml

Sample:
<SendEmailRequestDTO xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/QQSolutions.NextGen.ModelLibrary.DataTransferObjects.Emails">
  <AttachAcordList xmlns:d2p1="http://schemas.datacontract.org/2004/07/QQSolutions.NextGen.ModelLibrary.DataTransferObjects.ACORD">
    <d2p1:EmailAcordAttachDTO>
      <d2p1:AcordNameAsSent>sample string 2</d2p1:AcordNameAsSent>
      <d2p1:FromAcordEditor>true</d2p1:FromAcordEditor>
      <d2p1:ID>1</d2p1:ID>
    </d2p1:EmailAcordAttachDTO>
    <d2p1:EmailAcordAttachDTO>
      <d2p1:AcordNameAsSent>sample string 2</d2p1:AcordNameAsSent>
      <d2p1:FromAcordEditor>true</d2p1:FromAcordEditor>
      <d2p1:ID>1</d2p1:ID>
    </d2p1:EmailAcordAttachDTO>
  </AttachAcordList>
  <Attachments>
    <EmailFileAttachmentDTO>
      <FileId>1</FileId>
      <FileName>sample string 2</FileName>
    </EmailFileAttachmentDTO>
    <EmailFileAttachmentDTO>
      <FileId>1</FileId>
      <FileName>sample string 2</FileName>
    </EmailFileAttachmentDTO>
  </Attachments>
  <BccEmails>sample string 5</BccEmails>
  <Body>sample string 7</Body>
  <CcEmails>sample string 4</CcEmails>
  <ContactId>1</ContactId>
  <Description>sample string 9</Description>
  <EmailSource>sample string 10</EmailSource>
  <EmailUserAccountId>2</EmailUserAccountId>
  <ExcludeEmailSignature>true</ExcludeEmailSignature>
  <PolicyId>1</PolicyId>
  <Subject>sample string 6</Subject>
  <ToEmails>sample string 3</ToEmails>
  <UseSendGridApi>true</UseSendGridApi>
  <UseSystemEmailFrom>true</UseSystemEmailFrom>
</SendEmailRequestDTO>

Response Information

Resource Description

Always HTTP 200 with a body. Check IsSuccess to determine the outcome; on failure ErrorMessage and ErrorType describe why.

IHttpActionResult

None.

Response Formats

application/json, text/json, application/xml, text/xml

Sample:

Sample not available.