How to send a mail from an application ?

I need to send mail on the Net and on the local network…
There are several way to send an email from a Cocoa application:
1. involving an NSTask:
a. call a shell script invoking
b. call a Perl script invoking the function
c. use any script language with equivalent functionality…
2. using AppleScript: send AppleScript command to the target mailer application;
3. using the (undocumented ?)
[NSMailDelivery deliverMessage:headers:format:protocol:];

- (void) sendEmailTo:(NSString *) to subject:(NSString *) subject message:(NSString *) body imageData:(NSData *) imgData imageName:(NSString *) imgName
NSMutableAttributedString *aStr = [[[NSMutableAttributedString alloc] initWithString: [NSString stringWithFormat: @"%@nn", body]] autorelease];

if (imgData) {
NSFileWrapper *fw = [[[NSFileWrapper alloc] initRegularFileWithContents: imgData] autorelease];

[fw setPreferredFilename: imgName];
NSTextAttachment *ta = [[[NSTextAttachment alloc] initWithFileWrapper: fw] autorelease];
NSAttributedString *imgStr = [NSAttributedString attributedStringWithAttachment: ta];

[aStr appendAttributedString: imgStr];

if (body == nil)
body = @"" ;

NSMutableDictionary *headers = [NSMutableDictionary dictionaryWithObjectsAndKeys:to, @"To", subject, @"Subject", @"Apple Message Framework", @"X-Mailer", @"multipart/mixed", @"Content-Type", @"1.0", @"Mime-Version", nil];

BOOL didSend = [NSMailDelivery deliverMessage: aStr headers: headers format: NSMIMEMailFormat protocol: nil];
if (!didSend)
NSRunAlertPanel(nil, [NSString stringWithFormat:@"Could not send mail to %@",to], nil, nil, nil);
4. using some 3rd party framework written to help resolving the problem like Pantomine or EDMessage;
5. use the Java bridge and call JavaMail;
6. for sure another ones must exist somewhere… ;)