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



Mar 8, 2012, 3:04 PM
14 Posts
topic has been resolvedResolved

Try to send email as anonymous user but want the sender be my name

  • Category: Other
  • Platform: All
  • Release: 8.5.3
  • Role: Developer
  • Tags:
  • Replies: 2
I try to send mail from webpage and don't want Anonymous as sender. Have this code behind a button. Is it possible to harcode sender? Have highlighted the four line i use for this.
 
db1 = session.getDatabase(tmpServer,tmp);
doc1 = db1.createDocument()
doc1.appendItemValue("Form","Memo")
varBodyTXT = "tasks";
var1 = "Message sent"

var2 = "<b>" + varBodyTXT + "</b><br>" + getComponent("Name").getValue() + "<br><br>" + getComponent("email").getValue() + "<br>" + getComponent("phone").getValue() + "<br>" + getComponent("interest").getValue() + "<br>" + getComponent("other").getValue() + "<br>"

body = doc1.createMIMEEntity()
subject = body.createHeader("Subject")
subject.setHeaderVal(var1)

stream = session.createStream()
stream.writeText(var2)

body.setContentFromText(stream, "text/html; charset=iso-8859-1", 0)
tmpMail = rowDataV2.getColumnValues()[3];
sender = getComponent("email").getValue();
doc1.from=sender
doc1.SMTPOriginator=sender
doc1.Principal=sender

doc1.send(tmpMail);
context.reloadPage()
 
Regards
Willy
Mar 9, 2012, 8:17 AM
261 Posts
Re: Try to send email as anonymous user but want the sender be my name
Willy,
 
You might want to use my (SSJS) HTMLMail class for this. You can find it on the XSnippets site. The setSender should do what you want.
 
Not sure if it will work for Anonymous user though. You might have to use the sessionAsSigner object instead of the session object.
 
Mark
Mar 9, 2012, 8:56 AM
14 Posts
Re: Try to send email as anonymous user but want the sender be my name
Thanx Mark, just what I needed

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