Solved

Save LN mails send from asp.net in sent folder

Posted on 2010-11-19
8
541 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
  • 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

821 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