Posts

Post not yet marked as solved
1 Replies
1.3k Views
I am creating a macOS app that needs to be able to send and recieve specific emails for the user. I have somwhat successfully created the Sending system unfortuinitly the use does have to click the send button but everything else is taken care of. If you know a way to remove that step that would be nice. @IBAction func sendEmail(_ sender: Any) { let dateformatter = DateFormatter() dateformatter.dateStyle = DateFormatter.Style.short dateformatter.timeStyle = DateFormatter.Style.none let due = dateformatter.string(from: Due_Date.dateValue) let OS = dateformatter.string(from: SSOS.dateValue) let AS = dateformatter.string(from: SSAS.dateValue) dateformatter.dateStyle = DateFormatter.Style.none dateformatter.timeStyle = DateFormatter.Style.short let OSST = dateformatter.string(from: SSOSST.dateValue) let OSET = dateformatter.string(from: SSOSET.dateValue) let ASST = dateformatter.string(from: SSASST.dateValue) let ASET = dateformatter.string(from: SSASET.dateValue) let body = "**This is an automatically generated message using the Ticket Manager Software**\n\nTitle: " + Task_Title.stringValue + "\nTemplate: " + Temp.itemTitle(at: Temp.indexOfSelectedItem) + "\nEmployee Name: " + "ADD GLOBAL VAR" + "\nDue Date: " + due + "\n\nOriginal Shift: " + OS + "\n Start Time: " + OSST + "\n End Time: " + OSET + "\n\nAlternate Shift: " + AS + "\n Start Time: " + ASST + "\n End Time: " + ASET + "\n\nNotes: " + Task_Notes.stringValue let shareItems = [body] as NSArray let service = NSSharingService(named: NSSharingService.Name.composeEmail) service?.delegate = self service?.recipients = [Task_Recipient.stringValue] let subject = Task_Title.stringValue + " | #" + String(Int(Date().timeIntervalSince1970)) + " | " + due + " | " + Temp.itemTitle(at: Temp.indexOfSelectedItem) service?.subject = subject service?.perform(withItems: shareItems as [AnyObject]) self.view.window?.close() }I have not been able to locate an Library or SDK to be able to read emails. I have located the location of the emails in ~/Library/Mail/V6 but most of the files require special permissions. Any Ideas would be appreciated. Thanks in advance.
Posted Last updated
.