login about faq

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.


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");

asked Jul 25 '12 at 10:51

mark's gravatar image


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.


answered Jul 25 '12 at 16:45

chilkat's gravatar image

chilkat ♦♦

Ok, that makes sense. Turns out it was saving in Xcode's Build directory (~/Library/Build/Products..) since I was in debug mode. Digging in there, I found my "missing" eml files. Thanks!

(Jul 25 '12 at 17:25) mark

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


answered Jul 25 '12 at 15:36

jpbro's gravatar image

jpbro ♦

Good question! I tested it again and a relative path gives me a "No such file or directory" message but an absolute path (which I did not try before) works. Still not sure why, if I just put the filename without a path, I get what appears to be a silent error. For now, this will address my issue. Thanks.

(Jul 25 '12 at 16:09) mark

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

I don't understand. The LastErrorText is a string property that contains information about the last method call. There is no path involved w/ it..

(Jul 26 '12 at 17:30) chilkat ♦♦

OP wrote that "I tried passing a directory but it failed in that instance", but didn't specify in any detail what "failed". I was curious about what the contents of the LastErrorText property were in that scenario, since it might help diagnose the source of the problem.

I realize now that the grammar was ambiguous (my comment could be interpreted as "What are the contents of LastErrorText when you pass a path to it" as opposed to "What are the contents of LastErrorText after you pass a path to the SaveEml method and it fails?"

(Jul 26 '12 at 20:02) jpbro ♦
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: Jul 25 '12 at 10:51

Seen: 2,721 times

Last updated: Jul 26 '12 at 20:02

powered by OSQA