Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index

Thanks to a friend, who can read the code behind thinks, our problem to use LO and the API to send Emails is solved, without using the clibboard content.

There is made use off the script who gives problems when sending non-ascii chararters like( éèàç tec...) but this script can easly been altered

In origin there is a line

"textbody = textbody.encode('utf-8')"

add a extra line

"textbody = unicode( textbody, "utf-8" )

textbody = textbody.encode('utf-8')"

and you can send also non-ascii characters.

the code

Sub Main

oMailProvider = CreateUNOService("")
oCont = CreateUNOListener("CurCont_","")
oAuth = CreateUNOListener("Authent_","")
oTrans = CreateUNOListener("Trans_","")

oMailServiceObj =
oMail = oMailServiceObj.create( "", "", "the subject", oTrans)

xMailServer = oMailProvider.Create("")


End Sub

Function Trans_getTransferData(f) As Any
    if f.MimeType = "text/html" then
Trans_getTransferData = "<html><body><p>My Mail!</p></body></html>"
    end if
End Function

Function Trans_getTransferDataFlavors() As Variant
    Dim f As New
    f.MimeType = "text/html"
    Trans_getTransferDataFlavors = Array(f)
End Function

Function Trans_isDataFlavorSupported(f) As Boolean
   Trans_isDataFlavorSupported = (f.MimeType = "text/html")
End Function

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

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

Function Authent_GetPassword()
    Authent_GetPassword = "your_smtp_password"
End Function

Unsubscribe instructions: E-mail to
Posting guidelines + more:
List archive:
All messages sent to this list will be publicly archived and cannot be deleted


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.