Send email from Nu with MailCore

2 views
Skip to first unread message

Tim Burks

unread,
Nov 12, 2007, 5:34:44 PM11/12/07
to Programming Nu

Yesterday I discovered MailCore, an open-source Objective-C framework for sending and receiving email using SMTP and IMAP. MailCore is by Matt Ronge, and you can read about it and get it at his web site: http://www.theronge.com/mailcore/

If you want to build from source, you'll need to check out the source from his Mercurial archive. Instructions are here: http://www.kiwiclient.org/kiwi-wiki/RepositoryInformation

I've downloaded, built, and tested MailCore, and it works great with Nu. In fact, I'm using it to send this email.

- Tim

p.s. Here's the program that I used. I called it 'mail.nu' and ran it within TextMate to send this message.

==== mail.nu ====

;; MailCore example: sending mail

(load "MailCore") ;; load the MailCore framework.

(load "personal") ;; load my personal information.
;; This file defines a dictionary as follows:
;; (set personal (dict
;; "name" "my name"
;; "email" "my email address"
;; "server" "the name of my isp's mail server"
;; "username" "my username on the mail server"
;; "password" "my password on the mail server"))

(set msg ((CTCoreMessage alloc) init))
(msg setTo:(NSSet setWithObject:(CTCoreAddress addressWithName:"Programming Nu" email:"program...@googlegroups.com")))
(msg setFrom:(NSSet setWithObject:(CTCoreAddress addressWithName:(personal "name") email:(personal "email"))))
(msg setSubject:"Send email from Nu with MailCore")
(set body <<-BODY

Yesterday I discovered MailCore, an open-source Objective-C framework for sending and receiving email using SMTP and IMAP. MailCore is by Matt Ronge, and you can read about it and get it at his web site: http://www.theronge.com/mailcore/

If you want to build from source, you'll need to check out the source from his Mercurial archive. Instructions are here: http://www.kiwiclient.org/kiwi-wiki/RepositoryInformation

I've downloaded, built, and tested MailCore, and it works great with Nu. In fact, I'm using it to send this email.

- Tim

p.s. Here's the program that I used. I called it 'mail.nu' and ran it within TextMate to send this message.

==== mail.nu ====

BODY)
(body appendString:(NSString stringWithContentsOfFile:"mail.nu"))
(msg setBody:body)

(puts "sending...")

(CTSMTPConnection sendMessage:msg
server:(personal "server")
username:(personal "username")
password:(personal "password")
port:25 useTLS:YES useAuth:YES)

(puts "done")

Reply all
Reply to author
Forward
0 new messages