Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/282.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用PHP-EWS发送电子邮件时获取ErrorNonexistMailbox_Php_Php Ews - Fatal编程技术网

使用PHP-EWS发送电子邮件时获取ErrorNonexistMailbox

使用PHP-EWS发送电子邮件时获取ErrorNonexistMailbox,php,php-ews,Php,Php Ews,PHP-EWS版本:1.0.0-beta.2-PHP版本:5.5.9-Microsoft Exchange版本:2010 问题描述: 我试图使用php ews库发送一封连接到Exchange服务器的电子邮件,但收到一个不存在的邮箱错误。 要连接到Exchange服务器,我使用的帐户没有与之关联的默认邮箱。 在该服务器上,邮箱配置为可从我的帐户访问 例如 用于身份验证的Exchange帐户(域/用户):测试/bob 服务器上配置的邮箱:alice@sample.com,bob没有任何与之关联的默认

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

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

例如

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

我怎样才能发送电子邮件alice@sample.com使用我的帐户(bob)而不获取不存在的邮箱错误

请求代码

$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);
响应

$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);
无法创建带有ErrorNonexistMailbox的邮件