?
Solved

Save LN mails send from asp.net in sent folder

Posted on 2010-11-19
8
Medium Priority
?
551 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 2000 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
Not sure which OpenStack Certification to get?

So you’ve realized you might want to get certified in OpenStack, but you’re not sure what the benefits might be or even which one you should take. You know there are several certification courses you can choose from, but how do you know which one is right for you?

 
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

How To Install Bash on Windows 10

Windows’ budding partnership with Canonical has certainly led to some great improvements. One of them being the ability to use Bash on your Windows machine without third party applications! This might be one of the greatest things a cloud engineer in a Windows environment can do!

Question has a verified solution.

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

Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses

770 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