你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Send-AzEmailServicedataEmail

Queues an email message to be sent to one or more recipients

Syntax

Send-AzEmailServicedataEmail
    -Endpoint <String>
    [-ClientRequestId <String>]
    [-OperationId <String>]
    -Message <IEmailMessage>
    [-DefaultProfile <PSObject>]
    [-AsJob]
    [-NoWait]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]
Send-AzEmailServicedataEmail
    -Endpoint <String>
    [-ClientRequestId <String>]
    [-OperationId <String>]
    -ContentSubject <String>
    -RecipientTo <IEmailAddress[]>
    -SenderAddress <String>
    [-Attachment <IEmailAttachment[]>]
    [-ContentHtml <String>]
    [-ContentPlainText <String>]
    [-Header <Hashtable>]
    [-RecipientBcc <IEmailAddress[]>]
    [-RecipientCc <IEmailAddress[]>]
    [-ReplyTo <IEmailAddress[]>]
    [-UserEngagementTrackingDisabled]
    [-DefaultProfile <PSObject>]
    [-AsJob]
    [-NoWait]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]
Send-AzEmailServicedataEmail
    -Endpoint <String>
    [-ClientRequestId <String>]
    [-OperationId <String>]
    -JsonFilePath <String>
    [-DefaultProfile <PSObject>]
    [-AsJob]
    [-NoWait]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]
Send-AzEmailServicedataEmail
    -Endpoint <String>
    [-ClientRequestId <String>]
    [-OperationId <String>]
    -JsonString <String>
    [-DefaultProfile <PSObject>]
    [-AsJob]
    [-NoWait]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

Queues an email message to be sent to one or more recipients

Examples

Example 1: Queues an email message to be sent to one or more recipients

$emailRecipientTo = @(
   @{
        Address = "abc@contoso.com"
        DisplayName = "abc"
    }
)

$message = @{
	ContentSubject = "Test Email"
	RecipientTo = @($emailRecipientTo)  # Array of email address objects
	SenderAddress = 'info@contoso.com'	
	ContentPlainText = "This is the first email from ACS - HTML"	
}

Send-AzEmailServicedataEmail -Message $Message -endpoint "https://contoso.unitedstates.communication.azure.com"

AdditionalInfo    :
Code              :
Detail            :
Id                : 1111c0de-899f-5cce-acb5-3ec493af3800
Message           :
ResourceGroupName :
RetryAfter        :
Status            : Succeeded
Target            :

Queues an email message to be sent to one or more recipients, above is the example with only required fields.

Example 2: Queues an email message to be sent to one or more recipients

$emailRecipientTo = @(
   @{
        Address = "abc@contoso.com"
        DisplayName = "abc"
    },
   @{
        Address = "def@contoso.com"
        DisplayName = "def"
    }
)

$fileBytes1 = [System.IO.File]::ReadAllBytes("<file path>")

$fileBytes2 = [System.IO.File]::ReadAllBytes("<image file path>")

$emailAttachment = @(
	@{
		ContentInBase64 = $fileBytes1
		ContentType = "<text/plain>"
		Name = "<test.txt>"
	},
	@{
		ContentInBase64 = $fileBytes2
		ContentType = "image/png"
		Name = "<inline-attachment.png>"
		contentId = "<inline-attachment>"
	}
)

$headers = @{
    "Key1" = "Value1"
    "Key2" = "Value2"
	"Importance" = "high"
}

$emailRecipientBcc = @(
   @{
        Address = "abc@contoso.com"
        DisplayName = "abc"
    }
)

$emailRecipientCc = @(
   @{
        Address = "abc@contoso.com"
        DisplayName = "abc"
    }
)

$emailRecipientReplyTo = @(
   @{
        Address = "abc@contoso.com"
        DisplayName = "abc"
    }
)

$message = @{
	ContentSubject = "Test Email"
	RecipientTo = @($emailRecipientTo)  # Array of email address objects
	SenderAddress = 'info@contoso.com'
	Attachment = @($emailAttachment) # Array of attachments
	ContentHtml = "<html><head><title>Enter title</title></head><body><img src='cid:inline-attachment' alt='Company Logo'/><h1>This is the first email from ACS - HTML</h1></body></html>"
	ContentPlainText = "This is the first email from ACS - HTML"
	Header = $headers  # Importance = high/medium/low or X-Priority = 2/3/4  
	RecipientBcc = @($emailRecipientBcc) # Array of email address objects
	RecipientCc = @($emailRecipientCc) # Array of email address objects
	ReplyTo = @($emailRecipientReplyTo) # Array of email address objects
	UserEngagementTrackingDisabled = $true
}

Send-AzEmailServicedataEmail -Message $Message -endpoint "https://contoso.unitedstates.communication.azure.com"

AdditionalInfo    :
Code              :
Detail            :
Id                : 1111c0de-899f-5cce-acb5-3ec493af3801
Message           :
ResourceGroupName :
RetryAfter        :
Status            : Succeeded
Target            :

Queues an email message to be sent to one or more recipients, above is the example with all the fields.

Parameters

-AsJob

Run the command as a job

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Attachment

List of attachments. Please note that we limit the total size of an email request (which includes both regular and inline attachments) to 10MB.

Type:IEmailAttachment[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ClientRequestId

Tracking ID sent with the request to help with debugging.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ContentHtml

Html version of the email message.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ContentPlainText

Plain text version of the email message.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ContentSubject

Subject of the email message

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-DefaultProfile

The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.

Type:PSObject
Aliases:AzureRMContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Endpoint

The communication resource, for example https://my-resource.communication.azure.com

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Header

Custom email headers to be passed.

Type:Hashtable
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-JsonFilePath

Path of Json file supplied to the Send operation

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-JsonString

Json string supplied to the Send operation

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Message

Message payload for sending an email

Type:IEmailMessage
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-NoWait

Run the command asynchronously

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-OperationId

This is the ID provided by the customer to identify the long running operation. If an ID is not provided by the customer, the service will generate one.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-RecipientBcc

Email BCC recipients

Type:IEmailAddress[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-RecipientCc

Email CC recipients

Type:IEmailAddress[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-RecipientTo

Email To recipients

Type:IEmailAddress[]
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-ReplyTo

Email addresses where recipients' replies will be sent to.

Type:IEmailAddress[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-SenderAddress

Sender email address from a verified domain.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-UserEngagementTrackingDisabled

Indicates whether user engagement tracking should be disabled for this request if the resource-level user engagement tracking setting was already enabled in the control plane.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

IEmailMessage

Outputs

IEmailSendResult