7/01/2013

Outgoing email from mail-in db

Today I hit a new issue when designing a mail-in database with 3 different mail address. The system needs to be designed so that the response mail goes out from the original email address but the user name needs to hidden from the recipient. The issue is that when a user replies from the front end the mail would go out using his/her email alias. If I create a back-end agent and overwrite the smtporginator, inet and principal  fields. It won't solve the problem. The recipient is still able to see the user name in the mail as sent by John  / Jane Doe.

So what can be done to overcome this problem?

The solution I found was to put a mailoptions and saveoptions fields on the Reply form. Set both to 0 string. The send button only saves the doc and puts it in a view. I created a scheduled agent which sets the delivereddate, inetfrom, principal, smtporginator and recipient fields. Then the agent simply copies this doc into the mail.box. Voila! The router is sending out the mail. 

What we have got is a solution that sends the mail without highlighting who the user is in the sender field.
 

3/25/2013

IBM Notes Designer for iPhone :)

I was looking for a solution to do IBM Notes development with my iPhone. Here I am posting to you the solution :)

2/20/2013

LZ1 and Huffman compression problem in Lotus Notes client 8.5 with EmbeddedObjects

There are 2 databases and both have the LZ1 compression turned off.
The source db has a doc within an attachment without compression. When you extract the attachment and then attach it into a (new) doc in the destination db with the following call
Call body.embedObject(EMBED_ATTACHMENT, "", path, filename)
than the attachment is going to be compressed with LZ1 (even it is turned off in the database).
This came out on Lotus Notes client 8.5.

The solution is to use the Call body.CopyItemToDocument(doc,"Body") method.
Off course all the content of the richtext element copied to the destination document, if you only need the attachment than you must remove all the other content from the richtext item on the destination document.


2/11/2013

Change the default XPages View Collapse and Expand image

This is how you can change the default collapse and expand image for XPages views with 2 easy moves.
1st: add the following lines to your theme:

<control>
        <name>Column.View</name>
        <property>
            <name>collapsedImage</name>
            <value>/expand.gif</value>
        </property>
        <property>
            <name>expandedImage</name>
            <value>/collapse.gif</value>
        </property>

</control>

2nd: add the 2 gifs to the Resources/Images in your Lotus Notes designer.

The result is: all of your XPages views' collapse and expand image changed to your own customized image.
In this solution the changes are acting for both Lotus Notes and web-client.

Have nice and modern applications with XPages!

9/09/2012

Internet password security settings @ Lotus Domino 8.5.2 (Video)

This is how you can add an internet password security settings.


An other way to do the same:

 

Force a user to change Internet password on next login:


Force more users to change their Internet password on next login:



9/08/2012

Log method 1

"Creating log is a must." You can read those words in all specification. But who wants to redevelop this again and again. I made two different version for logging. In this discussion you will see how I do a log with the standard 'StdNotesLog' template.
First you must create a field in a profile document (or any similar solution), where you must defining where is the application's log nsf.
I have a log script library what I copying into the new application. I am going to show how I use it in an agent, but you can use it in the same way -for example- in a form.
In your next step you must "Use" the script library.
Use "log"
 Set the log db:
Call logdb.Openwithfailover(db.Server, profiledoc.logdb(0))
And you are ready to write into the log db:
Call logging( db.Server & "!!" & db.Filepath & " ~~ " & ag.Name & " agent started width rights of " & ag.Commonowner ) 
The logging method is waiting for a string. So you can do this too:
Call logging("Mail was send:" & Chr(13)_
            & dbltab & "From: " & maildoc.from(0) & Chr(13)_
            & dbltab & "To: " & Join(maildoc.SendTo , "; ") & Chr(13)_
            & dbltab & "Subject: " & maildoc.subject(0))
In this case there will be a multi line log entry. The dbltab is double tab (constant).
And here comes the  function:
%REM
    Function logging
    Created by Robert Takacs-Kral
%END REM
Function logging(eventstr As string)
    Dim eventItem As NotesItem
    If logview.AllEntries.Count = 1 Then Set logdoc = logview.GetFirstDocument() Else Set logdoc = logview.GetLastDocument()
   
    If Not logdoc Is Nothing Then
        If logdoc.Size > 30000 Then
            logdoc.FinishTime = Now()
            Call logdoc.Save(True, False)
            Set logdoc = Nothing
        End if
    End If
    If logdoc Is Nothing Then
        Set logdoc = logdb.Createdocument()
        logdoc.form = "Events"
        logdoc.server = logdb.server
        logdoc.StartTime = Now()
        Call logdoc.Save(True, False)
    End If
    Set eventItem = logdoc.getfirstitem("EventList")
    If eventItem Is Nothing Then
        Set eventItem = New NotesItem(logdoc, "EventList", Now() & " " & eventstr)
    Else
        Call eventItem.AppendToTextList( Now() & " " & eventstr)
    End If
    Call logdoc.Save(True, False)
   
End Function
This short code writes into the last log document, but when the size is near 32K close the current document and creates a new one.
This is a simple code but works well.

9/07/2012

Server-side mail export - EML

The issue was: creating a server-side solution for exporting emails to EML file from different mailboxes.
The application has a settings view, where the key user can set up different mail boxes for exporting.
This is cluster ready application.

Settings
Here comes the important part of the code.
function exportEML As Boolean
        On Error GoTo ErrHdl
        Dim fileNum As Integer
        Dim mime As NotesMIMEEntity
        Dim stream As NotesStream
        Dim evalstr As String
        Dim tmp As Variant
        Dim expFileName As String
        Dim mimeType As String
        Dim mimeBoundAryStart As string
        Dim mimeBoundAryEnd As string
        ss.Convertmime = False
       
        fileNum% = FreeFile()
        Set mime = maildoc.GetMIMEentity
        If mime Is Nothing Then
            Call maildoc.ConvertToMIME(3)
            Set mime = maildoc.GetMIMEentity
        End If
        If Not mime Is Nothing Then
            Set stream = ss.Createstream()
            expFileName$ = wDir & "\" & maildoc.Universalid & ".eml"
            ...
            If Dir$(expFileName$) <> "" Then
                Kill expFileName$
            ...
            End If
            Call stream.Open(expFileName$, mime.Charset)
            
...
            mimeType = mime.Contenttype
            mimeBoundAryStart = mime.Boundarystart
            mimeBoundAryEnd = mime.Boundaryend
            Call mime.GetEntityAsText(stream)
            Set mime = mime.GetNextEntity
            While Not mime Is Nothing
                Call stream.Writetext("", 3)
                Call stream.Writetext(mime.BoundAryStart)
                Call mime.DecodeContent()
                Call mime.Encodecontent( 1727 )
                Call mime.GetentityAsText(stream)
                Call stream.Writetext(mime.BoundAryEnd)
                Set mime = mime.GetNextEntity
            Wend
            Call stream.WriteText(mimeBoundAryEnd)
            Call stream.Close()
           
...
            exportEML = True
        Else
            ...
            exportEML = False
        End If
       
ErrHdl:
        If Err Then
            Print "  Error @ " & db.Filename & " (" & db.Title & ") - " & ag.Name & " - 'function exportEml' (" & Err & ") " & Error & " - line: " & Erl
            exportEML = false
            Exit Function
        End If
    End Function