I am facing problem on sending mail from my osx swift application. To send mail i used the below code
import Foundation
import Cocoa
class sendemail : NSObject
This works for me:
import Cocoa
class SendEmail: NSObject {
static func send() {
let service = NSSharingService(named: NSSharingServiceNameComposeEmail)!
service.recipients = ["abc@dom.com"]
service.subject = "Vea software"
service.performWithItems(["This is an email for auto testing through code."])
}
}
Usage:
SendEmail.send()