this code works fine but it pops a window, then have to click send. Can I send it in the background without pops a window? Thank everybody!
import Cocoa
class SendEmail: NSObject {
static func send() {
let service = NSSharingService(named: NSSharingServiceNameComposeEmail)!
service.recipients = ["[email protected]"]
service.subject = "Vea software"
service.performWithItems(["This is an email for auto testing through code."])
}
}
SendEmail.send()
CodePudding user response:
You can't do that, this would be quite not secure if a dev could sent any email from user's address without even letting him know
In background you can send a http request to your server which will send an email, but it will send it from your developer/organization/etc address, not from user's one ofc.