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


Ich versuche ein Writerdokument (doc) als PDF-Datei im Anhang eines
Mails zu versenden aber leider kommt nur ein leerer Anhang mit dem Mail
an. Weiß wer was hier falsch ist?

Global oOutputStream as Object

Sub Mailtest(Doc as Object)
Dim Attachment(1) as Object

oOutputStream=CreateUnoService("com.sun.star.io.outputstream")
Dim args(1) as New com.sun.star.beans.PropertyValue
args(0).Name="FilterName"
args(0).Value="writer_pdf_Export"
args(1).Name="OutputStream"
args(1).Value=oOutputStream
doc.store(args())


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")
oAtt =CreateUNOListener("Att_","com.sun.star.datatransfer.XTransferable")
Attachment=CreateObject("com.sun.star.mail.MailAttachment")
Attachment.data=oAtt
Attachment.ReadableName="Testattachment.pdf"
oMailServiceObj = com.sun.star.mail.MailMessage
oMail = oMailServiceObj.createwithattachment( "to@me.at", "from@me.at",
"the subject", oTrans,Attachment)

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 Att_getTransferData(f) As Any
     if f.MimeType = "application/pdf" then
         Att_getTransferData = oOutputstream
     end if
End Function

Function Att_getTransferDataFlavors() As Variant
     Dim f As New com.sun.star.datatransfer.DataFlavor
     f.MimeType = "application/pdf"
     f.HumanPresentableName="PDF-Datei"
     Att_getTransferDataFlavors = Array(f)
End Function

Function Att_isDataFlavorSupported(f) As Boolean
    Att_isDataFlavorSupported = (f.MimeType = "application/pdf")
End Function

-- 
Reinhard


-- 
Informationen zum Abmelden: E-Mail an users+help@de.libreoffice.org
Probleme? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Tipps zu Listenmails: http://wiki.documentfoundation.org/Netiquette/de
Listenarchiv: http://listarchives.libreoffice.org/de/users/
Alle E-Mails an diese Liste werden unlöschbar öffentlich archiviert

Context


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.