Re: Send Email with "deliverMessage"
Re: Send Email with "deliverMessage"
- Subject: Re: Send Email with "deliverMessage"
- From: Julien Dufour <email@hidden>
- Date: Fri, 9 Apr 2004 17:55:33 +0200
On Apr 7, 2004, at 14:41, Lorenzo wrote:
Hi,
with my and some other computers my application can send emails with
the API
--
[NSMailDelivery deliverMessage:...
--
but some other people cannot. They can quite send emails through "Apple
Mail" application. They well defined an account there, the password,
the
SMTP... so they can send emails with "Apple Mail" application.
They have no firewall on outgoing messages.
What else should I check and fix?
Hello
The NSMailDelivery API is currently rather unreliable when used in a
product targeting a large public. In fact, it can be laborious to get
working the first time, but once a user has succeeded sending one
message, it works fine.
The secret shelter of the beast:
According to my investigations, the issues are related to the way it
retrieves the mail settings (outgoing mail server (SMTP) and e-mail
address of the sender). This information is dug from both Mail.app
preferences and Internet Config settings. Mail.app is always having
priority, so IC is consulted only when Mail.app has never been
configured.
In Mail.app, the first e-mail address in the list of the first e-mail
account is retrieved (I haven't checked wether disabled accounts are
ignored or not, I guess not). The retrieved SMTP server is the first
one of the list of SMTP servers, *regardless* of the ones set in the
e-mail accounts!
Internet Config works simpler, there is only one entry for each setting
(kICSMTPHost and kICEmail). Although the Internet preference pane has
gone under Panther, the IC settings are still taken into account when
they are available. The users which have upgraded from Jaguar and
preserved their account may have some values set up in their
preferences.
It is easy to fall:
Here is the most common troubles:
1/ No SMTP servers can be found => the deliverMessage: methods return
NO immediately.
2/ An invalid SMPT server has been found => the deliverMessage: methods
return NO after trying to contact the server, this may take some time.
3/ The found SMTP server and e-mail address don't match so that the
SMTP refuses to relay the message => the deliverMessage: methods return
YES since the message has been delivered to the server, but it never
reaches the recipient. However, the sender is likely to receive a
warning from the SMTP server.
Where it becomes really fun:
Even when the issue has been identified for a given user, the game is
not finished. In Mail.app, the are no ways to reorder the SMTP servers.
Under Panther, it is only possible to create, modify and delete
servers, under Jaguar, it is even no possible to delete them! A short
excursion in ~/Library/Preferences/com.apple.mail.plist may be
required. As stated above, the Internet preference pane is not
available under Panther. Thus, it is not directly possible to modify
the IC settings, another excursion in the preference files may have to
be scheduled.
The good news:
When the user is using Mail.app, has a single mailbox, and has
configured the application using the initial assistant, everything
should be ok. I guess/hope it is the case of a lot of users. Things can
become tricky when the user is using Mail.app with multiple mailboxes.
However, if he was able to configure multiple accounts, we can suppose
he should be able to change the settings to get NSMailDelivery working
if something is wrong. Finally, when the user is using another e-mail
client, he just has to run Mail.app once to configure it (not to hard).
Last note. I have investigated under both Jaguar and Panther, but not
under Puma or Cheetha. Moreover, there are no ways to know what
NSMailDelivery is really doing, so this information may be wrong or
incomplete.
Best Regards
--
Lorenzo
email: email@hidden
Best regards.
Julien Dufour
Inferiis -
http://www.inferiis.com
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.