Now make use of a NGMimeFileData object to avoid broken SOPE behaviour
parent
3175a9169f
commit
b95362f963
|
@ -62,6 +62,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#import <NGImap4/NSString+Imap4.h>
|
#import <NGImap4/NSString+Imap4.h>
|
||||||
|
|
||||||
#import <NGMime/NGMimeBodyPart.h>
|
#import <NGMime/NGMimeBodyPart.h>
|
||||||
|
#import <NGMime/NGMimeFileData.h>
|
||||||
#import <NGMime/NGMimeMultipartBody.h>
|
#import <NGMime/NGMimeMultipartBody.h>
|
||||||
#import <NGMail/NGMimeMessageParser.h>
|
#import <NGMail/NGMimeMessageParser.h>
|
||||||
#import <NGMail/NGMimeMessage.h>
|
#import <NGMail/NGMimeMessage.h>
|
||||||
|
@ -1359,6 +1360,13 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
NGMimeMessageParser *parser;
|
NGMimeMessageParser *parser;
|
||||||
NSData *data;
|
NSData *data;
|
||||||
|
|
||||||
|
NGMimeMessageGenerator *generator;
|
||||||
|
NGMimeBodyPart *bodyPart;
|
||||||
|
NGMutableHashMap *map;
|
||||||
|
NGMimeFileData *fdata;
|
||||||
|
NSException *error;
|
||||||
|
id body;
|
||||||
|
|
||||||
userFolder = [[context activeUser] homeFolderInContext: context];
|
userFolder = [[context activeUser] homeFolderInContext: context];
|
||||||
accountsFolder = [userFolder lookupName: @"Mail" inContext: context acquire: NO];
|
accountsFolder = [userFolder lookupName: @"Mail" inContext: context acquire: NO];
|
||||||
currentFolder = [accountsFolder lookupName: @"0" inContext: context acquire: NO];
|
currentFolder = [accountsFolder lookupName: @"0" inContext: context acquire: NO];
|
||||||
|
@ -1380,10 +1388,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
// We create a new MIME multipart/mixed message. The first part will be the text part
|
// We create a new MIME multipart/mixed message. The first part will be the text part
|
||||||
// of our "smart forward" and the second part will be the message/rfc822 part of the
|
// of our "smart forward" and the second part will be the message/rfc822 part of the
|
||||||
// "smart forwarded" message.
|
// "smart forwarded" message.
|
||||||
NGMimeBodyPart *bodyPart;
|
|
||||||
NGMutableHashMap *map;
|
|
||||||
id body;
|
|
||||||
|
|
||||||
map = [NGHashMap hashMapWithDictionary: [messageFromSmartForward headers]];
|
map = [NGHashMap hashMapWithDictionary: [messageFromSmartForward headers]];
|
||||||
[map setObject: @"multipart/mixed" forKey: @"content-type"];
|
[map setObject: @"multipart/mixed" forKey: @"content-type"];
|
||||||
|
|
||||||
|
@ -1398,21 +1402,26 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
[body addBodyPart: bodyPart];
|
[body addBodyPart: bodyPart];
|
||||||
|
|
||||||
// Second part
|
// Second part
|
||||||
// FIXME - SOPE (read "POS") generates garbage if we only have the content-type header
|
|
||||||
map = [[[NGMutableHashMap alloc] initWithCapacity: 1] autorelease];
|
map = [[[NGMutableHashMap alloc] initWithCapacity: 1] autorelease];
|
||||||
[map setObject: @"message/rfc822" forKey: @"content-type"];
|
[map setObject: @"message/rfc822" forKey: @"content-type"];
|
||||||
|
[map setObject: @"8bit" forKey: @"content-transfer-encoding"];
|
||||||
bodyPart = [[[NGMimeBodyPart alloc] initWithHeader:map] autorelease];
|
bodyPart = [[[NGMimeBodyPart alloc] initWithHeader:map] autorelease];
|
||||||
[bodyPart setBody: [mailObject content]];
|
|
||||||
|
data = [mailObject content];
|
||||||
|
fdata = [[NGMimeFileData alloc] initWithBytes:[data bytes]
|
||||||
|
length:[data length]];
|
||||||
|
|
||||||
|
[bodyPart setBody: fdata];
|
||||||
|
RELEASE(fdata);
|
||||||
[body addBodyPart: bodyPart];
|
[body addBodyPart: bodyPart];
|
||||||
[messageToSend setBody: body];
|
[messageToSend setBody: body];
|
||||||
|
|
||||||
NGMimeMessageGenerator *generator;
|
|
||||||
generator = [[[NGMimeMessageGenerator alloc] init] autorelease];
|
generator = [[[NGMimeMessageGenerator alloc] init] autorelease];
|
||||||
data = [generator generateMimeFromPart: messageToSend];
|
data = [generator generateMimeFromPart: messageToSend];
|
||||||
|
|
||||||
NSException *error = [self _sendMail: data
|
error = [self _sendMail: data
|
||||||
recipients: [messageFromSmartForward allRecipients]
|
recipients: [messageFromSmartForward allRecipients]
|
||||||
saveInSentItems: ([(id)[theDocumentElement getElementsByTagName: @"SaveInSentItems"] count] ? YES : NO)];
|
saveInSentItems: ([(id)[theDocumentElement getElementsByTagName: @"SaveInSentItems"] count] ? YES : NO)];
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue