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
Swift 4.2:
class SendEmail: NSObject { static func send() { let service = NSSharingService(named: NSSharingService.Name.composeEmail)! service.recipients = ["email@yourEmail.eu"] service.subject = "Email Subject" service.perform(withItems: ["Email Content"]) } }
Usage: SendEmail.send()
SendEmail.send()