Archived Forum Post

Index of archived forum posts

Question:

SaveEml - where does it save and can you specify a directory?

Jul 26 '12 at 20:02

Development target: Objective-C, Mac OS Lion

I'm trying to save an email using the CkoEmail component. It is reporting success, but I cannot find the mail anywhere. Where does save default to saving? I thought it would put it in my user directory (~/) but it's not there. I tried passing a directory but it failed in that instance. How would you pass a directory?

Here's my sample code. "success = [myEmail SaveEml:@"myEmail.eml"];" returns "YES" and there's nothing in the error text.

Thanks!

CkoEmail *myEmail = [[CkoEmail alloc] init];
BOOL success;
success = [myEmail UnlockComponent: @"Unlockme"];
if (success != YES) {
    NSLog(@"Unlock component failure");
}
myEmail.Subject = @"My subject";
myEmail.Body = @"This is the body";
myEmail.From = @"randomemail@chilkats0ft.com";
[myEmail AddTo:@"Chilkat" emailAddress:@"randomemail@chilkats0ft.com"];
success = [myEmail SaveEml:@"myEmail.eml"];
if (!success) {
    NSLog(@"Not successfull.");
    NSLog(@"%@", myEmail.LastErrorText);
} else {
    NSLog(@"Was successful");
}

Accepted Answer

If you pass a filename with no directory path (absolute or relative), then you are specifying a file in the current working directory (See: Concept of Working Directory)

If you pass a relative path, then it is a path relative to the current working directory. This applies to any Chilkat method where a filepath is passed in an argument.


Answer

What are the contents of LastErrorText when you supply a path?