sharatha / skpsmtpmessage

Automatically exported from code.google.com/p/skpsmtpmessage
0 stars 0 forks source link

The error that the other server returned was: 552 552 message line is too long #31

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
i send image in e-mail and have this is an automatically generated Delivery 
Status Notification

Technical details of permanent failure:
Google tried to deliver your message, but it was rejected by the recipient 
domain. We recommend 
contacting the other email provider for further information about the cause of 
this error. The error 
that the other server returned was: 552 552 message line is too long (state 18).

how chnge long ?

Original issue reported on code.google.com by LeshikM...@gmail.com on 15 Apr 2009 at 3:38

GoogleCodeExporter commented 9 years ago
ok i change -(NSString *)encodeBase64ForData in NSData+Base64Additions.m

#define PARTS_LENGTH 512

-(NSString *)encodeBase64ForData
{
    NSMutableString *encodedString = nil;

    // Make sure this is nul-terminated.
    size_t outBufferEstLength = EstimateBas64EncodedDataSize([self length]) + 1;
    char *outBuffer = calloc(outBufferEstLength, sizeof(char));

    size_t outBufferLength = outBufferEstLength;
    if (Base64EncodeData([self bytes], [self length], outBuffer, &outBufferLength, FALSE))
    {
        encodedString = [NSMutableString stringWithCString:outBuffer encoding:NSASCIIStringEncoding];

        //divide string
        int length = [encodedString length];
        int partsCount = length/PARTS_LENGTH;

        for(int i = partsCount; i >= 1; i--)
        {
            [encodedString insertString:@"\n" atIndex: PARTS_LENGTH*i];
        }
    }
    else
    {
        [NSException raise:@"NSData+Base64AdditionsException" format:@"Unable to encode data!"];
    }

    free(outBuffer);

    return encodedString;
}

and all good work.

Original comment by LeshikM...@gmail.com on 23 Apr 2009 at 2:33