0

PHP-EWS 版本:1.0.0-beta.2 - PHP 版本:5.5.9 - Microsoft Exchange 版本:2010

问题描述:我正在尝试使用 php-ews 库发送一封连接到 Exchange 服务器的电子邮件,但我收到 Not Existing Mailbox 错误。要连接到 Exchange 服务器,我使用的帐户没有关联的默认邮箱。在该服务器上,邮箱配置为可以从我的帐户访问。

例如

用于身份验证的 Exchange 帐户(域/用户):test/bob 服务器上配置的邮箱:alice@sample.com,bob 没有与之关联的任何默认邮箱 bob 被允许访问 alice@sample.com 邮箱

如何使用我的帐户 (bob) 从 alice@sample.com 发送电子邮件而不会收到非现有邮箱错误?

请求代码

$client = new Client($host, $username, $password, $version);
     
// Build the request
    
$request = new CreateItemType();
$request->Items = new NonEmptyArrayOfAllItemsType();

// Save the message, but do not send it.

$request->MessageDisposition = MessageDispositionType::SAVE_ONLY;

// Create the message.

$message = new MessageType();
$message->Subject = $subject;
$message->ToRecipients = new ArrayOfRecipientsType();

// Set the sender.

$message->From = new SingleRecipientType();
$message->From->Mailbox = new EmailAddressType();
$message->From->Mailbox->Name = "Alice";
$message->From->Mailbox->EmailAddress = "alice@sample.com";

// Set the recipient.

$recipient = new EmailAddressType();
$recipient->Name = 'name';
$recipient->EmailAddress = 'address';
$message->ToRecipients->Mailbox[0] = $recipient;

// Set the message body.

$message->Body = new BodyType();
$message->Body->BodyType = BodyTypeType::HTML;
$message->Body->_ = $body;

// Add the message to the request.

$request->Items->Message[] = $message;
$response = $client->CreateItem($request);

回应

使用 ErrorNonExistentMailbox 创建消息失败

4

0 回答 0