Solved

Sending mail to lotus notes server

Posted on 2004-04-22
9
2,194 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is an old article, please see an updated version of this article, located here: http://www.experts-exchange.com/articles/23619/Notes-8-5x-Windows-7-Notes-info-and-tips.html
For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

688 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