1

uploadAttachment -- no response

I'm using the PHP library http://github.com/michaelcurtis/ymailphp

All of the other methods work for me except the uploadAttachment method. Anyone have any idea of why I get this response?

YMClientException Object ( [ :private] => 0 [ :private] => Bad response from Ymail: HTTP 0, Content-Type: [ ] => Ymail request failed [ :private] => [ ] => 0 [ ] => /home/test/api/ymclient.php [ ] => 75 [ :private] => Array ( [0] => Array ( [file] => /home/test/api/test.php [line] => 125 [function] => __call [class] => YMClient [type] => -> [args] => Array ( [0] => UploadAttachment [1] => Array ( [0] => Array ( [0] => stdClass Object ( [uploadfile] => Array ( [path] => img.jpeg )

                                                [output] => json
                                            )

                                    )

                                [1] => Array
                                    (
                                        [oauth_token] => A=YJG68jWcm1...bmCGttSwPlIZsdiQTkg
                                        [oauth_token_secret] => 8a49...dcbed23386
                                        [oauth_expires_in] => 3600
                                        [oauth_session_handle] => AEcdCVI...RKId_oLcg-
                                        [oauth_authorization_expires_in] => 770468811
                                        [xoauth_yahoo_guid] => 6R2ZFMZ4H3LIZN66IFXM5C6JMA
                                    )

                            )

                    )

            )

...

[<previous:Exception>:private] => 

)

by
3 Replies
  • Its because UploadAttachment has a different endpoint than whats defined in that script. For download the endpoint should be http://mail.yahooapis.com/ya/upload . You can get the details from http://developer.yahoo.com/mail/docs/user_guide/UploadAttachment.html.

    I don't think the library handles it. You can always fork it.

    0
  • Sorry for the delayed response. I got pulled away on another project. Anyway, I had already changed the endpoint. I'm making my request like so:

    $req = new stdclass();
    $req->uploadfile = array( 'path' => '/test/api/img.jpeg');
    $req->output = 'json';
    $messages = $ymc->UploadAttachment($req);
    print '--<br>';
    print $messages;
    
    

    I appreciate any advice. I'm actually just trying to forward a message, but it's my understanding that I have to read in the original message and then generate a new message to send from the original message. The images and attachments are the only part I can't get working so that's why I'm focusing on getting UploadAttachment working as I assume I have to download the images (which I can do) and then re upload them as attachments for the new message.

    0
  • DOH! I had a typo that was screwing up my endpoint change. I've fixed that. At least now I'm getting a documented error.

    [<errorCode:YMClientException>:private] => 404
    [<detail:YMClientException>:private] => Bad response from Ymail: HTTP 404, Content-Type: text/html; charset=iso-8859-1
    [<message:protected>] => Ymail request failed 
    
    0

Recent Posts

in Yahoo! Mail Web Services API