Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Save LN mails send from asp.net in sent folder

Posted on 2010-11-19
8
Medium Priority
?
557 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
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
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

Fill in the form and get your FREE NFR key NOW!

Veeam® is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

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

This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

610 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