Tôi đang gặp sự cố khi gửi thư từ ứng dụng nhanh chóng của mình. Để gửi thư tôi sử dụng mã dưới đâygửi email từ ứng dụng nhanh chóng của osx
import Foundation
import Cocoa
class sendemail : NSObject, NSSharingServiceDelegate{
func sendEmail() throws
{
print("enter email sending")
let body = "This is an email for auto testing throug code."
let shareItems = [body] as NSArray
let service = NSSharingService(named: NSSharingServiceNameComposeEmail)
service?.delegate = self
service?.recipients = ["[email protected]"]
let subject = "Vea Software"
service?.subject = subject
service?.performWithItems(shareItems as [AnyObject])
}
}
tôi đã tìm thấy nguồn gốc hình thành liên kết này: https://www.veasoftware.com/posts/send-email-in-swift-xcode-62-os-x-1010-tutorial
Nhưng nó không phải đang làm việc.
Tôi cũng đã cố gắng để gửi thư từ thiết bị đầu cuối theo hướng dẫn này:
http://www.developerfiles.com/how-to-send-emails-from-localhost-mac-os-x-el-capitan/
nó nói:
postfix/postfix-script: fatal: the Postfix mail system is not running
hãy giúp tôi.
Tôi có thể gửi thư từ ứng dụng thư mac của mình theo cách thủ công được định cấu hình.
Tôi đang sử dụng
xcode 7.3, osx el captain and swift 2.2
cảm ơn rất nhiều sự giúp đỡ của bạn. Nhưng nó không hoạt động ở đây ...: (.... là điều này cần thiết để thiết lập bất cứ điều gì như postmail để chạy thành công này? –
Làm việc cho tôi mà không cần thiết lập thêm. – dawid