View Full Version : Mailing data back home
Hi all,
OK, not specifically a game related thing, but...
My carbon app has a log file. When Things Go Wrong™ on my tester's and customer's machines, I need to see this log file.
what options do I have with getting this log file by mail? (I don't want to send data surreptitiously.) Ideally, I'd like to have a new mail document generated, with email address pointing to my support emal address, subject line, and either the log file attached, or just plain text inserted in the mail document, all ready for the user to hit the Send button.
Doable?
thanks.
OneSadCookie
2005.04.08, 09:18 PM
easily doable with applescript.
Through carbon?
Please elaborate? Thanks.
OneSadCookie
2005.04.08, 10:13 PM
You can make applescript calls through carbon, but I've never tried it. I've successfully used the "osascript" command-line utility to do precisely what you want, though. You can always call out to that with system() if your app is Mach-O.
kodex
2005.04.08, 10:58 PM
Cocoa Soultion
#import <Message/NSMailDelivery.h>
[NSMailDelivery deliverMessage: msgText subject: msgSubj to: msgDest];
This will send a email from the users default mail address. It will automaticly compose and send but will prompt the user to authorize your app to access the keychain for the mail password. Hope this helps
wadesworld
2005.04.09, 10:30 AM
You can do it through carbon, either with the osascript solution OSC mentions, or by writing the code to send an AppleEvent.
Wade
Danlab
2005.04.10, 11:03 AM
look at apple website there is an exemple of how to execute applescript using carbon
and there is a script in this exemple how to send an email too
Excellent! Thanks for all the help -- I'll try the Applescript through Carbon route for now.
ta.
radiance
2005.04.10, 10:07 PM
AFAIK, with AppleScript you'll need to write a different script for each particular email client. The AppleScriptRunner sample code shows ones for Entourage and Mail, which probably covers most users, but it necessitates asking the user which email client they use, which is a bit of a pain. Still, I guess it's better than my current method of asking the user to do all the work of emailing the error file to me.
You might consider having the program upload the log file to your web or ftp site, which would cut out all the middle-men. I hear it's pretty easy to do, although I haven't personally tried it yet. I've had others direct me to libcurl (http://curl.haxx.se/), which seems like it might be just the thing.
Of course, you'd still need to ask permission to send the file, just in case they have Little Snitch running or something :)
Good point. I noticed that you have to choose which application specifically. Argh, it's never easy is it.. ;)
I'm trying to add the Applescripts to my bundle's Resource directory. I need to have them in an Applescripts folder (or at least some folder). Yet when I try to add the folder to Xcode, the folder is not copied in my bundle, only the scripts themselves. Is there a way to make Xcode include the folder?
thanks again.
vBulletin® v3.6.8, Copyright ©2000-2008, Jelsoft Enterprises Ltd.