HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Programming/Scripts (http://www.howtoforge.com/forums/forumdisplay.php?f=7)
-   -   problem sending email with attachment (http://www.howtoforge.com/forums/showthread.php?t=52988)

marleyblu 7th June 2011 16:55

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.


All times are GMT +2. The time now is 23:39.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.