Skip to main content
This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal

Notes/Domino 6 and 7 Forum

Notes/Domino 6 and 7 Forum


  

PreviousPrevious NextNext

(java example) Sending html email, and hiding part of a link?
~Ethan Fezavitch 24.Sep.03 09:11 AM a Web browser
Notes Client 6.0 Windows XP


Here is an example of a Java Agent sending HTML:

public class clnSendHTMLmail extends AgentBase {

public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();

// (Your code goes here)
Stream stream = session.createStream();
session.setConvertMIME(false); // Do not convert MIME to RT

Database db = agentContext.getCurrentDatabase();
Document doc = db.createDocument();
doc.replaceItemValue("Form", "Memo");
MIMEEntity body = doc.createMIMEEntity();
MIMEHeader header = body.createHeader("Subject");
header.setHeaderVal("MIME message");

header = body.createHeader("To");
boolean status = header.setHeaderVal("your_email@your_domain.com");

stream.writeText("<h1>My headline</h1><p>This is some text</p><font color=FF0000>This line is red</font><p><a href=\"http://www.google.com\">Go to Google</a>");
// body.setContentFromText(stream, "text/plain;charset=UTF-8", MIMEEntity.ENC_NONE);
body.setContentFromText(stream, "text/html;charset=UTF-8", MIMEEntity.ENC_NONE);

Vector v = new Vector();
v.addElement(session.getUserName());
v.addElement("ts@interactive.as");
v.addElement("sales@dom.com");
if(status)
doc.save(false);
else
System.out.println("ERROR: setHeaderVal() = false)");
doc.send(false,v);
doc.remove(true);

// Always set to true if set to false at the begining
session.setConvertMIME(true); // Restore conversion

} catch(Exception e) {
e.printStackTrace();
}
}
}




Sending html email, and hiding part... (~Wendy Umjumite... 23.Sep.03)
. . RE: Sending html email, and hiding ... (~Sean Fezjipyte... 23.Sep.03)
. . RE: Sending html email, and hiding ... (~Yentl Quetkrot... 23.Sep.03)
. . (java example) Sending html email, ... (~Ethan Fezavitc... 24.Sep.03)


Document Options






  Document options
Print this pagePrint this page

Search this forum

Forum views and search


  Forum views and search
Date (threaded)
Date (flat)
With excerpt
Category
Platform
Release
Advanced search

Member Tools


RSS Feeds

 RSS feedsRSS
All forum posts RSS
All main topics RSS