I've used this in a shop prototype ... worked fine for me.
The ugly thing about it is that I create the message text inside the
xsp-page. Have to change that to using an internel cocoon pipeline.
Hope that helps.
Chris
<?xml version="1.0" encoding="UTF-8"?>
<xsp:page xmlns:xsp="http://apache.org/xsp"
xmlns:xsp-session="http://apache.org/xsp/session/2.0"
create-session="true"
xmlns:xsp-request="http://apache.org/xsp/request/2.0"
xmlns:sendmail="http://apache.org/cocoon/sendmail/1.0">>
<xsp:structure>
<xsp:include>java.util.Hashtable</xsp:include>
<xsp:include>java.util.Iterator</xsp:include>
<xsp:include>java.util.Enumeration</xsp:include>
</xsp:structure>
<page>
<xsp:logic>
Hashtable cart = (Hashtable) session.getAttribute("cart");
if(cart == null) {
cart = new Hashtable();
}
StringBuffer body = new StringBuffer();
body.append("Hiermit bestätigen wir den Erhalt Ihrer Bestellung\n\nEs
wurden die folgenden Produkte bestellt:\n");
int totalPrice = 0;
Iterator keys = cart.keySet().iterator();
while(keys.hasNext()) {
String key = (String) keys.next();
CartEntry cartEntry = (CartEntry) cart.get(key);
totalPrice += (cartEntry.getCount() * cartEntry.getPrice());
body.append(cartEntry.getCount() + "x " + cartEntry.getDescription() + "
(" + key + ") Einzelpreis: " + cartEntry.getPrice() + "€ Gesamtpreis: "
+ (cartEntry.getPrice() * cartEntry.getCount()) + "€\n");
}
body.append("1 x Versandkosten in Höhe von 10,00€\n");
body.append("Das ergibt einen Gesamtrechnungsbetrag von " + (totalPrice
+ 10) + "€\n");
body.append("\nEs wurden die folgenden Kontaktdaten angegeben:\n");
body.append(session.getAttribute("firstName") + " " +
session.getAttribute("lastName") + "\n");
body.append(session.getAttribute("street") + "\n");
body.append(session.getAttribute("zipCode") + " " +
session.getAttribute("city") + "\n");
body.append(session.getAttribute("phone") + "\n");
body.append(session.getAttribute("email") + "\n");
if(session.getAttribute("freePictureNumber") != null) {
body.append("\nEs wurde das kotenlose Bild Nr. " +
session.getAttribute("freePictureNumber") + " gewählt\n");
}
body.append("\nBei dieser Mail handelt es sich lediglich um eine
Bestätigungsmail, das Ihre Bestellung entgegen genommen wurde. Es wird
sich in kürze ein Mitarbeiter mit Ihnen in Verbindung setzen, um die
details zu besprechen.\n");
boolean success;
</xsp:logic>
<title>Bestellbestätigung</title>
<paragraph height="305">
<sendmail:send-mail>
<sendmail:from>{input-from-email-address-here}</sendmail:from>
<sendmail:to>{input-to-email-address-here}</sendmail:to>
<sendmail:subject>Bestellung</sendmail:subject>
<sendmail:smtphost>{input-mail-server-host-here}</sendmail:smtphost>
<sendmail:body><xsp:expr>body.toString()</xsp:expr></sendmail:body>
<sendmail:on-success>
<br/>
Wir danken für Ihre Bestellung
<br/>
<br/>
Sie erhalten umgehend eine E-Mail mit der Bestellbestätigung und
<br/>
weiterführenden Informationen zur Bestellungsabwicklung.
</sendmail:on-success>
<sendmail:on-error>
<text>Es ist ein interner Fehler aufgetreten. Ihre Bestellung konnte
nicht in das System aufgenommen werden. Bitte setzen Sie sich direkt mit
uns in Verbindung.</text>
</sendmail:on-error>
</sendmail:send-mail>
</paragraph>
</page>
</xsp:page>
J.D. Williams wrote:
Greetings.
I would like to include a form on my website, so that visitors can
send comments or questions via email. Is this a good application for
the Cocoon sendmail action?
If so, could someone point me to a working sample of the mail block?
If this has been addressed on the list before, I have not found it in
the archives.
What do you need to get the "/samples/blocks/mail/sendmail/new.html"
page to show up?
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]