View Single Post
  #1  
Old 7th June 2011, 17:55
marleyblu marleyblu is offline
Junior Member
 
Join Date: Jun 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default problem sending email with attachment

I'm new to using EWS from Exchangeclient classes.

I'm looking for a simple example how to send an email with an attachment. I've found examples about how to send an email but not sending an email with an attachment.

This is my script:
PHP Code:
$exchangeclient = new Exchangeclient();
$exchangeclient->init($username$passwordNULL'ews/Services.wsdl');
$exchangeclient->send_message($mail_from$subject$body'HTML'truetrue); 

I have the following soap request.
PHP Code:
$CreateItem->MessageDisposition "SendAndSaveCopy";
    
$CreateItem->SavedItemFolderId->DistinguishedFolderId->Id "sentitems";

    
$CreateItem->Items->Message->ItemClass "IPM.Note";
    
$CreateItem->Items->Message->Subject $subject;
    
$CreateItem->Items->Message->Body->BodyType $bodytype;
    
$CreateItem->Items->Message->Body->$content;
    
$CreateItem->Items->Message->ToRecipients->Mailbox->EmailAddress $to
$CreateItem->Items->Message->Attachments->FileAttachment->AttachmentId $attach['AttachmentId'];
    
$CreateItem->Items->Message->Attachments->FileAttachment->Name $attach['Name'];
    
$CreateItem->Items->Message->Attachments->FileAttachment->ContentType $attach['ContentType'];
    
$CreateItem->Items->Message->Attachments->FileAttachment->ContentId $attach['AttachmentId'];
    
$CreateItem->Items->Message->Attachments->FileAttachment->Content $attach['ContentId'];
    
$CreateItem->Items->Message->Attachments->FileAttachment->Size $attach['Size']; 
The error I am getting is:

Fatal error: Uncaught SoapFault exception: [a:ErrorSchemaValidation] The request failed schema validation: The required attribute 'Id' is missing.

Thanks.
Reply With Quote
Sponsored Links