none
error "code 400 bad request. the data is invalid" RRS feed

  • Question

  • Hi All

    I am trying send email via ActiveSync protocol. here my request but I got error "code 400 bad request. the data is invalid" help me find error please.

    POST /Microsoft-Server-ActiveSync?User=Zxxxxx&DeviceId=Axxxxx&DeviceType=iPad&Cmd=SendMail&SaveInSent=T HTTP/1.1

    Host: mds-mailsync.myhost.com

    Content-Type: message/rfc822 Ms-Asprotocolversion: 12.1

    User-Agent: Apple-iPad2C1/807.4

    X-Ms-Policykey: xxxxxxx

    Authorization: Basic xxxxxxx

    Accept: */* Accept-Language: de-de

    Accept-Encoding: gzip, deflate

    Connection: keep-alive

    but I got response from 400 error from server. what is wrong ?

    Tuesday, May 24, 2011 9:33 AM

Answers

  • ialeksey,

    According to your Content-Type header, you are sending data that is formulated according to rfc822.
    However, it seems as though the payload is in XML form.

    It seems like this may be your issue.

    Look at this example:

    POST /Microsoft-Server-ActiveSync?Cmd=SendMail&User=ninja&DeviceId=Axxxxx&DeviceType=iPad&SaveInSent=T HTTP/1.1

    Content-Type: message/rfc822

    MS-ASProtocolVersion: 12.1

    User-Agent: Apple-iPad2C1/807.4

    Host: mail.epicwin.com

     

    From: ninja

    To: dude@epicwin.com

    Cc:

    Bcc:

    Subject: SUBJECT

    MIME-Version: 1.0

    Content-Type: text/html; charset="iso-8859-1"

    Content-Transfer-Encoding: 7bit

    X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3350

    MESSAGE

     

    Does this solve your issue?

    Wednesday, May 25, 2011 6:36 PM

All replies

  • Hi ialeksey,

    Thanks for your question.

    Someone from my team will contact you shortly to work on this inquiry.

     

    Regards,


    SEBASTIAN CANEVARI - MSFT Escalation Engineer Protocol Documentation Team
    Tuesday, May 24, 2011 6:33 PM
  • ialeksey,

    Perhaps the problem isn't with the HTTP header, but with the body / metadata. Can you show that?

    Brad

    Tuesday, May 24, 2011 10:08 PM
  • Also, which parts of [MS-ASCMD] and [MS-ASEMAIL] are you referring to for your development?
    Tuesday, May 24, 2011 11:09 PM
  • Hi  Brad thanks for replay.

    based on [MS-ASCMD] document. here is body for sending email. (4.6    Sending E-Mail Messages by Using the SendMail Command)

     <?xml version="1.0" encoding="utf-8"?>
        <SendMail xmlns="ComposeMail:">
        <ClientId>633916348086136195</ClientId>
        <SaveInSentItems />
        <Mime>From: testuser1 To: testuser2
         Cc:Bcc: Subject: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1"
         Content-Transfer-Encoding: 7bit
         X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3350
         This is the e-mail body content.</Mime>
         </SendMail>

     

     but I got response  400 error from server.

     

     

    Wednesday, May 25, 2011 6:21 AM
  • ialeksey,

    According to your Content-Type header, you are sending data that is formulated according to rfc822.
    However, it seems as though the payload is in XML form.

    It seems like this may be your issue.

    Look at this example:

    POST /Microsoft-Server-ActiveSync?Cmd=SendMail&User=ninja&DeviceId=Axxxxx&DeviceType=iPad&SaveInSent=T HTTP/1.1

    Content-Type: message/rfc822

    MS-ASProtocolVersion: 12.1

    User-Agent: Apple-iPad2C1/807.4

    Host: mail.epicwin.com

     

    From: ninja

    To: dude@epicwin.com

    Cc:

    Bcc:

    Subject: SUBJECT

    MIME-Version: 1.0

    Content-Type: text/html; charset="iso-8859-1"

    Content-Transfer-Encoding: 7bit

    X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3350

    MESSAGE

     

    Does this solve your issue?

    Wednesday, May 25, 2011 6:36 PM