Re: sending html in email <SOLVED>
Re: sending html in email <SOLVED>
- Subject: Re: sending html in email <SOLVED>
- From: Mike Schrag <email@hidden>
- Date: Wed, 21 Mar 2007 22:36:35 -0400
So, I decided to go with the project wonder solution, my ER version
did not include this mail stuff. The remaining issue that held me
up was email address validation. I wanted some feedback from the
transport system upon failure and abort the send should failure
occur--no bounce. My testing seemed to indicate that such behavior
only works by using sendMail(boolean), not sendMail(). This is
unclear from the docs because they suggest that there is a callback
to be used for this, but all such API is deprecated without
alternate usage documented.
Couple things on this one:
1) I don't know why the old API was deprecated, but it was kind of
weird (which is maybe why?), so it's just as well.
2) I just now committed a replacement API for this because I was
wondering the same thing just this morning. There is now an
ERMessage.Delegate interface with:
public void deliverySucceeded(ERMessage message);
public void invalidRecipients(ERMessage message, NSArray
invalidRecipientAddresses);
public void deliveryFailed(ERMessage message, Throwable failure);
... read the javadocs for more info on the specifics
3) To use this, you do erMailDelivery.setDelegate(new
ERMessage.Delegate() { ... }) (obviously you can just pass in an
existing instance there. ERMailDelivery also has a new userInfo
dictionary you can set on it that will get pushed into any ERMessage
that is created, so if you need additional info in your delegate, you
can store it in there.
One thing to note is that deliveryFailed is called any time a failure
happens INCLUDING in response to invalidRecipients --
invalidRecipients will fire first, followed by the failure
notification. The delegate is notified on non-blocking (deferred) OR
blocking calls.
Incidentally, I also just added support just recently for defining a
text alternative component in addition to the normal html component
when you use ERMailDeliveryHTML, so that might be useful to you also.
I'm just now kicking off a Wonder build with these changes, so it
should be available on the mdimension.com build server in about 10
minutes.
The docs do say, however, that using this overload will block the
thread until either pass/fail, so what I still wonder is if this
will block the entire app instance, holding up other users online
at the same time???? Anyone know?
If you sendMail(false), your message goes into a queue that sends in
a background thread. The message is generated in the thread that you
call sendMail in, though, so from a locking standpoint, if you lock
any editing context around the sendMail call that you use in the
email component, you are OK either way.
if you call sendMail(true), the call will block THE CURRENT THREAD
until the message is sent. That is, you're not going to block the
entire application just by doing that. However, you will block the
current user, which may suck just as much.
ms
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden