Re: Cocoa and email (SMTP/POP3)
Re: Cocoa and email (SMTP/POP3)
- Subject: Re: Cocoa and email (SMTP/POP3)
- From: David Blanton <email@hidden>
- Date: Wed, 24 Jun 2009 13:59:08 -0600
Look at CFNetwork Programming Guide.
See CFWriteStreamRef and CFReadStreamRef.
You can write a simple SMTP process in one page of code.
Contact me off list if you want some code.
db
On Jun 24, 2009, at 1:02 PM, Jeremy Pereira wrote:
Everybody seems to have forgotten that this thread was started by
somebody who was attempting to write a mail client of their own, for
learning purposes. Therefore, it strikes me as slightly pointless
to implement it by scripting to another mail client.
The correct way for a mail client to resolve the issue is to have a
preference which lists the name(s) or IP address(es) of the outgoing
SMTP server(s) and then always connect to that/those server(s) to
send mail in much the same way as mail.app does.
You can
* use sendmail
* use some third party library
* connect to the SMTP server's SMTP port direct.
Using sendmail may be a bad option since your mail app will want to
be informed of errors in submitting the mail. Sendmail (what's on
the Mac is not actually sendmail but a compatibility wrapper for
postfix, but that is not important) might just accept the mail and
then queue it or deliver a bounce message to your sender address.
Sending to the SMTP port direct is pretty easy unless you want to do
any of the more complex stuff like authentication or TLS - which,
unfortunately, if you want a half way serious mail client, you will
need to support.
I'd recommend finding some third party library. This one
(Pantomime) seems to fit the bill:
http://www.collaboration-world.com/cgi-bin/project/index.cgi?pid=3
Disclaimer: I don't know anything about it, it was just the top hit
on my Google search just now.
On 24 Jun 2009, at 06:27, Andrew Farmer wrote:
On 23 Jun 2009, at 21:52, Jeff Laing wrote:
Ok, I'll bite.
How does the mail server that Mail.app is talking to distinguish
between Mail.app and /usr/sbin/sendmail ? They both presumably
just talk SMTP ?
Mail.app is configurable by the user to connect to a specific relay
mail server, potentially using login credentials, SSL, and/or an
alternate port. Sendmail, by contrast, is not configurable (without
cracking open the terminal, at least), and will by default always
connect directly to the destination mail server. It's this exact
behavior that makes it unlikely to work properly.
Consider also that not all users even have Mail.app configured. An
increasing number of users use online mail services such as GMail
exclusively. In their case, not even scripting Mail.app will help
you.
If you really need to deliver email notifications from an
application, the only reliable solution is to put together a
properly secured web-to-email gateway for your application
somewhere and use that. Sending email directly from the desktop is
no longer a viable solution without explicit configuration.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden