https://bugs.freedesktop.org/show_bug.cgi?id=66761

          Priority: medium
            Bug ID: 66761
          Keywords: regression
          Assignee: [email protected]
           Summary: Other: Pyton Mailmerge broken
          Severity: normal
    Classification: Unclassified
                OS: Windows (All)
          Reporter: [email protected]
          Hardware: Other
        Whiteboard: BSA
            Status: UNCONFIRMED
           Version: 4.0.0.3 release
         Component: BASIC
           Product: LibreOffice

sinds 4.0 sending emails using the mailmerge.py is no longer working

Steps to reproduce:
the code below worked fine until 3.6 , using the cliboard to email the content
of thiscomponent 



Sub Main

oMailProvider = CreateUNOService("com.sun.star.mail.MailServiceProvider")
oCont = CreateUNOListener("CurCont_","com.sun.star.uno.XCurrentContext")
oAuth = CreateUNOListener("Authent_","com.sun.star.mail.XAuthenticator")
'xCopyToClipboard("tekst als body")
copydoccontentToClipboard
oClip = CreateUnoService("com.sun.star.datatransfer.clipboard.SystemClipboard")

oMailServiceObj = com.sun.star.mail.MailMessage
rem
http://api.openoffice.org/docs/common/ref/com/sun/star/mail/MailMessage.html
rem Use the contents of the clipboard as the content of the email
xMailServer = oMailProvider.Create("com.sun.star.mail.SMTP")
xMailServer.Connect(oCont,oAuth)
'msgbox xMailServer.isConnected
'sendarray() = split("[email protected] , [email protected]")
oMail = oMailServiceObj.create("[email protected]" , "[email protected]", "Verschenen
berichten van SOUDAL",oClip.getContents()) 
'for i = 1 to ubound(sendarray())
'omail.addattachment(sendarray(i))
'next i
xMailServer.SendMailMessage(oMail)
xMailServer.Disconnect()

End Sub

Function CurCont_GetValueByName(s) as Any
    Select Case s
        Case "ServerName"
            CurCont_GetValueByName = "yourmailserver"
        Case "Port"
            CurCont_GetValueByName = 25
        Case "ConnectionType"
            CurCont_GetValueByName = "Insecure"
    End Select
End Function

Function Authent_GetUserName() as Any
    Authent_GetUserName = "youremailaccount"
End Function

Function Authent_GetPassword()
    Authent_GetPassword = "yourpasswordt"
End Function

Sub xCopyToClipboard(mytext as string)
dim document   as object
dim dispatcher as object
dim oDoc, oVC, Mark, var
oVC = ThisComponent.CurrentController.getViewCursor

If Not isEmpty(oVC.TextTable) then  ' Cursor is in een Tabel
otext = oVC.texttable.getcellbyname(oVC.cell.cellname,true).text
textincell = oText.string
oText.string = ""
otext.insertstring(oVC,mytext,false)
oVC.gotostart(true)
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dispatcher.executeDispatch(ThisComponent.CurrentController.Frame, ".uno:Copy",
"", 0, Array())
otext.string = textincell ' oude text terug zetten !
else
If Not isEmpty(oVC.TextFrame)then
oVC.String = mytext 
Mark = oVC.TextFrame.text.createTextCursorbyRange(oVC)
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dispatcher.executeDispatch(ThisComponent.CurrentController.Frame, ".uno:Copy",
"", 0, Array())
'oVC.gotostart(true)
oVC.String = ""
else
'gewoon in de text
oVC.String = mytext
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dispatcher.executeDispatch(ThisComponent.CurrentController.Frame, ".uno:Copy",
"", 0, Array())
oVC.String = ""
endif
endif

End sub

sub copydoccontentToClipboard
dim document   as object
dim dispatcher as object
dim oDoc, oVC, Mark, var
oVC = ThisComponent.CurrentController.getViewCursor
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dispatcher.executeDispatch(ThisComponent.CurrentController.Frame,
".uno:SelectAll", "", 0, Array())
dispatcher.executeDispatch(ThisComponent.CurrentController.Frame,
".uno:SelectAll", "", 0, Array())
dispatcher.executeDispatch(ThisComponent.CurrentController.Frame, ".uno:Copy",
"", 0, Array())
end sub


Operating System: Windows 8
Version: 4.0.0.3 release
Last worked in: 3.6.6.2 release

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs

Reply via email to