Solved

Sending mail to lotus notes server

Posted on 2004-04-22
9
2,112 Views
Last Modified: 2013-12-18
Hi All;
I am very new to lotus notes and I am trying to send a email through lotus notes server but I am getting the following exception:
"4271 Password or other security violation for database"

I have installed the Lotus Notes client on my m/c ver. 5.0.3. and I am trying to connect to remote server
Here is the Code that i using
----------------------------
import lotus.domino.*;

public class SendLotusMail extends AgentBase {    
public static void main(String args[]) {
          String userID = "uid";

          String pwd = "passwd";
          String serverName = "server_name";
          String mailfile = "mail_file";
          try {
               NotesThread.sinitThread();
               String x = null;
               Session session = NotesFactory.createSession(x, x, pwd);
               Database db = session.getDatabase(server_name, mailfile);
               Document email = db.createDocument();
               email.appendItemValue("From","the junk address");              
               email.appendItemValue("Subject", "Test Secure E-Mail ");
               email.appendItemValue("ReturnReceipt", "1");
               //add attatchment
               RichTextItem rtitem = email.createRichTextItem("Body");
               rtitem.embedObject(
                    EmbeddedObject.EMBED_ATTACHMENT,
                    null,
                    "C:\\Windows\\15658.pdf",
                    "15658");

               email.setSignOnSend(true);
               email.sign();
               email.send(true,"recepient mail address ");
          } catch (NotesException e) {              
               
               System.out.println("Exception--->" + e.id + " " + e.text);
          }

     }
}
0
Comment
Question by:arun2702
  • 3
  • 3
9 Comments
 
LVL 19

Accepted Solution

by:
RanjeetRain earned 39 total points
ID: 10888721
try changing this line
        Session session = NotesFactory.createSession(x, x, pwd);
to
        Session session = NotesFactory.createSession(serverName, userID, pwd);





0
 
LVL 31

Expert Comment

by:qwaletee
ID: 10888910
Hi arun2702,
>      NotesThread.sinitThread();
>                String x = null;
>                Session session = NotesFactory.createSession(x, x, pwd);


Limit your initial try block to those three statements, then try successive statments in their own try blocks, so you can diagnose which statment is giving an access violation.  You might also try recording session.getEffectiveUserName() to see if your login ID is what you expect, then use the Notes client with the ID file that matches that login to do the equivalent operations...

    - create a memo
    - set subject text
    - set the return receipt option, signature
    - embed a file in the message body
    - send

Note that you should have a replaceItemValue("Form","Memo")... and that replaceItemValue is much preferable to appendItemValue.

Cheers!
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 10888915
Good catch Ranjeet!  I didn't even notice that he weirded out that call.
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 19

Expert Comment

by:RanjeetRain
ID: 10889221
Thanks Qwaletee!
0
 

Author Comment

by:arun2702
ID: 10906921
Thanks a ton for ur replies , after modifying the code for Form
I am getting following error:
"Configuration setting for Server either missing or Invalid"

can u help me solve it.......
0
 
LVL 19

Expert Comment

by:RanjeetRain
ID: 10918320
Check your server document. Or it may be due to corruption???
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 10923316
You would only get that if a Domino server tried to start up, and teh ID it started up with did not have a server settings document in the directory.  Now, perhaps you are trying to do something on your workstation that makes Domino think you are trying to run a server process?
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

You’ve got a lotus Domino web server, and you have been told that “leverage browser caching” is a must do. This means that we have to tell the browser everywhere in the web to use cache. In other words, we set (and send) an expiration date in the HT…
This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now