send email to generic ID in lotus notes using notesFactory in java

varsha :

Their is a requirement in a project to send emails from java application through lotus notes.

Note: the domino server is installed on client server.

Currently i am able to send email using notesFactory on my local machine.using notes.jar file

Which accesses the user by .nsf by its password.

I.e creating secure connection by password. And gtting database object by calling

Session.getdatabase(null,"user.nsf")

Its perfectly working.

But for some types of emails the client have shared a generic id...(link) over an email... By clicking on that link the generic mail box opens under active user. In separate tab... Through which we can send emails.

But have not shared their .nsf path or id or password.

It directly opens by clicking on that link.

Now i want to access that generic id in notesfactory session

I tried to keep open that id and then running my code...but still it sends email through active user itself.

And client is not ready to share the id and password details of that user. Not the id file is getting generated in our local machine.

Is their any way to send emails through that id?

If anyone want code i am using..ill share.

Karl-Henry Martinsson :

But for some types of emails the client have shared a generic id...(link) over an email... By clicking on that link the generic mail box opens under active user. In separate tab... Through which we can send emails.

That does not sound like a "shared id", it sounds more like a mail database with the ACL set to give a group of users access. When you send an email from within Notes (no matter if it is through the UI or through code), the actual logged in user is used as the sender. It is intentionally by design, to prevent users from spoofing the sender.

There is an unsupported way to fake the sender address, by dropping the email directly into mail.box, but that should only be done by someone know what they are doing.

I wrote a script library several years ago, intended to help sending emails. It includes the ability to set the sender address. You can find it on my blog, it's free to use. But I would not recommend you using it without first understanding what the code is doing.

Here is the relevant part of the code:

   Set mailbox = New NotesDatabase(mailservername,"mail.box")
   If mailbox.Isopen = False Then
      Print "mail.box on " & mailservername & " could not be opened"
      Exit Sub
   End If
   Set me.maildoc = New NotesDocument(mailbox)
   Call me.maildoc.ReplaceItemValue("Form","Memo")
   Set me.body = New NotesRichTextItem(maildoc,"Body")
   Call maildoc.ReplaceItemValue("Principal", me.p_principal)
   ' If principal is set, we want to fix so mail looks like
   ' it is coming from that address, need to set these fields
   Call maildoc.ReplaceItemValue("From", me.p_principal)
   Call maildoc.ReplaceItemValue("Sender", me.p_principal)
   Call maildoc.ReplaceItemValue("ReplyTo", me.p_principal)
   Call maildoc.ReplaceItemValue("SMTPOriginator", me.p_principal)
   Call maildoc.ReplaceItemValue("PostedDate",Now())
   If me.p_principal<>"" Then
      Call maildoc.Save(True,False) ' Save in mail.box
   Else
      Call maildoc.Send(True)       ' Send mail normally
   End If   

You use the Principal field to set the sender address.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=25206&siteId=1