1

php-ewsを使用してメールを送信していますが、メールの重要度(優先度)を設定する方法が見つかりません。これが私のコードです:



    $from = $mail['from'];
    $to = $mail['to'];
    $subject = $mail['subject'];
    $body = $mail['body'];

    $msg = new EWSType_MessageType();
    if($to && count($to) > 0){
        $toAddresses = $this->getAddresses($to);
        $msg->ToRecipients = $toAddresses;
    }

    $fromAddress = new EWSType_EmailAddressType();
    $fromAddress->EmailAddress = $from['mail'];
    $fromAddress->Name = $from['name'];

    $msg->From = new EWSType_SingleRecipientType();
    $msg->From->Mailbox = $fromAddress;

    $msg->Subject = $subject;

    $msg->Body = new EWSType_BodyType();
    $msg->Body->BodyType = 'HTML';
    $msg->Body->_ = $body;

    $msgRequest = new EWSType_CreateItemType();
    $msgRequest->Items = new EWSType_NonEmptyArrayOfAllItemsType();

    $msgRequest->Items->Message = $msg;
    $msgRequest->MessageDisposition = 'SendAndSaveCopy';
    $msgRequest->MessageDispositionSpecified = true;

    $response = $this->ews->CreateItem($msgRequest);
    return $response;

よろしくお願いします!

4

2 に答える 2

1

EWSType_ImportanceChoicesTypeクラスをロードする必要があります。コードは次のようになります。

$from = $mail['from'];
$to = $mail['to'];
$subject = $mail['subject'];
$body = $mail['body'];

$msg = new EWSType_MessageType();
if($to && count($to) > 0){
    $toAddresses = $this->getAddresses($to);
    $msg->ToRecipients = $toAddresses;
}

$fromAddress = new EWSType_EmailAddressType();
$fromAddress->EmailAddress = $from['mail'];
$fromAddress->Name = $from['name'];

$msg->From = new EWSType_SingleRecipientType();
$msg->From->Mailbox = $fromAddress;

$msg->Subject = $subject;

$msg->Body = new EWSType_BodyType();
$msg->Body->BodyType = 'HTML';
$msg->Body->_ = $body;

$msgRequest = new EWSType_CreateItemType();
$msgRequest->Items = new EWSType_NonEmptyArrayOfAllItemsType();

$msgRequest->Items->Message = $msg;
// Start importance code
$msgRequest->Items->Message->Importance = new EWSType_ImportanceChoicesType();
$msgRequest->Items->Message->Importance->_ = EWSType_ImportanceChoicesType::HIGH;
// End importance code
$msgRequest->MessageDisposition = 'SendAndSaveCopy';
$msgRequest->MessageDispositionSpecified = true;

$response = $this->ews->CreateItem($msgRequest);
return $response;

重要度を変更するには、次の行の末尾をHIGH、LOW、またはNORMALに変更します。

$msgRequest->Items->Message->Importance->_ = EWSType_ImportanceChoicesType::HIGH;
于 2013-04-25T19:49:16.687 に答える
0

私はphpにあまり詳しくありませんが、C#を使用している場合、mailmessage-classには列挙型である「Importance」プロパティがあり、High、Low、およびNormalに設定できます。デフォルトは「通常」です。

これがお役に立てば幸いです...

于 2013-03-27T12:42:13.613 に答える