Re: how to create a HREF inside a email message-javamail
Re: how to create a HREF inside a email message-javamail
- Subject: Re: how to create a HREF inside a email message-javamail
- From: Serge Froment <email@hidden>
- Date: Thu, 23 Oct 2003 11:05:19 -0400
Hi Leon,
I build HTML mail content by simply using normal WebObject pages. Here
is the relevant code coming from one of my component action methods:
NewPhotosEmail email = (NewPhotosEmail)
pageWithName("NewPhotosEmail");
email.setArtist(artist);
email.setPhotos(photos);
String message = email.generateResponse().contentString();
I just pass the "message" string as the email content. You can put in
the mail page everyting a normal web page would contain. The instance
variables of the mail page will be used as usual. The only gotcha is
that URL generated by WebObjects WOHyperlink components are relative to
the web server htdoc folder. I solve this by adding a "base url"
component in the header of my mail page, like this:
<HTML>
<HEAD>
<META NAME="generator" CONTENT="WebObjects 5.2">
<TITLE>Annonce de nouvelles photos</TITLE>
<WEBOBJECT NAME=baseURL></WEBOBJECT>
</HEAD>
baseURL: WOGenericContainer
{
elementName = "BASE";
href = baseURL;
}
The href binding contains "http://myDomainName.com". Since I found no
WebObject method returning this URL correctly in both dev and
deployment configurations, I put the value in the Property file or in
runtime arguments.
Serge Froment
http://informagique.qc.ca
Le jeudi, 16 oct 2003, ` 21:05 America/Montreal, Leon zhao a icrit :
> I am writing some code about emailing to every users of my forum. In
> the body of the email message, an url is embedded to redirect the
> users to the forum. Currently, I am using the format like
>
> String theURL = "http://www.myforum.com"
> strMessage.append(theURL);
>
> Then send the strMessage out.
> I want we have the URL look like
>
> Please click here to reenter the system
>
> I know I need something like <A HREF =
> "http://www.myforum.com">please click here to reenter the system</A>
>
> but how can I put all these (and probably other html tags) into
> String theURL?
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.