Solved

Save LN mails send from asp.net in sent folder

Posted on 2010-11-19
8
545 Views
Last Modified: 2013-12-18
With attached code I send mails from asp.net application via Lotus Notes. After sending mail has been stored in sent folder. I have a problem that sent mail is not saved in principal`s Sent folder (I have all necessary permissions), instead my sent mail has been saved in folder of logged user. How can I save sent mails in folder of a user that is assigned as principal?

Thanks
Sub ComposeNotesMail()

        Dim sess As New NotesSession
        Dim db As NotesDatabase
        Dim doc As NotesDocument
        Dim body As Object
        Dim mailServer As String, mailFile As String


        ' Init Notes session
        Call sess.Initialize("password")

        ' Open user's email
        mailServer = sess.GetEnvironmentString("MailServer", True)
        mailFile = sess.GetEnvironmentString("MailFile", True)
        db = sess.GetDatabase(mailServer, mailFile)

        If db.IsOpen Then
            doc = db.CreateDocument
        Else
            MsgBox("Could not open Notes", 32)
        End If

        ' Create an email doc
        doc = db.CreateDocument
        Call doc.ReplaceItemValue("Form", "Memo")
        Call doc.ReplaceItemValue("SendTo", adresa.Text.Trim)
        Call doc.ReplaceItemValue("CopyTo", cc.Text.Trim)
        Call doc.ReplaceItemValue("Subject", subject.Text.Trim)
        Call doc.ReplaceItemValue("Principal", "CN=App1/O=texttext/C=text")

        body = doc.CreateRichTextItem("BODY")
        Call body.AppendText(sadrzaj.Text)
        Call body.AddNewLine()
        Call body.AddNewLine()

        If FileUpload1.PostedFile.FileName <> "" Then
            Call body.Embedobject(1454, "", FileUpload1.PostedFile.FileName) '"c:\Testattachment.txt")
        Else
            Call body.AppendText("")
        End If

        doc.SaveMessageOnSend = True

        Call doc.Send(False)

        doc.SaveMessageOnSend = True

        sess = Nothing
        db = Nothing
        doc = Nothing

    End Sub

Open in new window

0
Comment
Question by:kahvedzic
[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
  • 4
  • 3
8 Comments
 
LVL 22

Accepted Solution

by:
mbonaci earned 500 total points
ID: 34172252
The mail will always be stored in the signed-in user's mail file.
The only way to do that is to manually move (copy and delete) the document from one db to another.
0
 
LVL 1

Author Comment

by:kahvedzic
ID: 34172295
OK, but when I try from LN client to send mail from other mail address it save mail in sent folder of address that I sent it from, not mine (logged) sent folder.
0
 
LVL 22

Expert Comment

by:mbonaci
ID: 34172320
When you say "send mail from other mail address" you mean you open other user's mail file and compose and send e-mail from there?
The problem is that Lotus, when using COM, determines the mail db using the logged-in user info.

There's no setting that you can change to "become some other user", besides user log-in.

Or did you mean something else by "send mail from other mail address"?
0
Independent Software Vendors: 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 1

Author Comment

by:kahvedzic
ID: 34172373
Yes, I mean that I have permission to open and compose other user`s id file and compose/send mail.

I don`t wont to "become some other user", I want to have same options in my app as I have in LN client but if it is not possible then it`s OK.

Thanks anyway for clearing this up.

Cheers!
0
 
LVL 3

Expert Comment

by:ironclads
ID: 34174235
You could have an agent that runs, either when mail is sent or upon a collection of mail being sent.  This agent would take the message and create a copy of it in the right db or send it again, this time to the right person, based on a key, either in the message or based on another key stored somewhere.  Then no matter where the message goes, there is a copy in the right location.

Not knowing all your particulars and with everyone else's confusion too, I'm just giving you some ideas and will need more info to nail down your intent.

Good Luck.

-TIM
0
 
LVL 1

Author Comment

by:kahvedzic
ID: 34185919
This sounds like OK solution, but how to create agent, can you please provide me with code?
0
 
LVL 22

Expert Comment

by:mbonaci
ID: 34188088
You would really duplicate the e-mail messages?
No, sorry, but IMHO this sounds like a bad idea.
0
 
LVL 1

Author Comment

by:kahvedzic
ID: 34188689
Then nothing, I will continue working as I was before. Thanks everybody for help.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

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…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

749 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