Solved

Save LN mails send from asp.net in sent folder

Posted on 2010-11-19
8
536 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
 
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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
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 run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

760 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now