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 Mailmerge.py 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("com.sun.star.mail.MailServiceProvider")
oCont = CreateUNOListener("CurCont_","com.sun.star.uno.XCurrentContext")
oAuth = CreateUNOListener("Authent_","com.sun.star.mail.XAuthenticator")
oTrans =
CreateUNOListener("Trans_","com.sun.star.datatransfer.XTransferable")
oMailServiceObj = com.sun.star.mail.MailMessage
oMail = oMailServiceObj.create( "[email protected]", "[email protected]", "the
subject", oTrans)
xMailServer = oMailProvider.Create("com.sun.star.mail.SMTP")
xMailServer.Connect(oCont,oAuth)
xMailServer.SendMailMessage(oMail)
xMailServer.Disconnect()
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 com.sun.star.datatransfer.DataFlavor
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 = "your.smtp.server.com"
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 [email protected]
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.documentfoundation.org/www/discuss/
All messages sent to this list will be publicly archived and cannot be deleted