NACHTRAG: Ergänzt um Betriebssystem-Unabhängigkeit (Windows Linux)
Sub MailVersand
Dim mTo as String
Dim mSubject as String
Dim mCC() as String
Dim mBCC() as String
Dim mAttachement() as String
Dim mBody as String
Dim oMailAgent as Object
Dim oMailClient as Object
Dim oMailMessage as Object
mTo = "HansWernerHerold@t-online.de"
mSubject = " Test, Test, Test ..."
mCC = Array("OoOHWHOoO@t-online.de","HansWernerHerold@t-online.de")
mBCC = Array("OoOHWHOoO@t-online.de","HansWernerHerold@t-online.de")
mAttachement =
Array(ConvertToUrl("E:\TMP\WRITER.odt"),ConvertToUrl("E:\TMP\CALC.ods"))
mBody = "hallo, hallo" & Chr(10) & "Und, tschüss" & Chr(10) & "PS:"
Select Case GetGUIType()
Case 1 ' Windows
oMailAgent = createUnoService("com.sun.star.system.SimpleSystemMail")
Case 4 ' Linux
oMailAgent = CreateUnoService("com.sun.star.system.SimpleCommandMail")
Case Else ' Betriebssysten unbekannt
MsgBox("Das Betriebssystem ist weder Windows noch Linux !")
End
End Select
oMailClient = oMailAgent.querySimpleMailClient()
oMailMessage = oMailClient.createSimpleMailMessage()
oMailMessage.setRecipient(mTo)
oMailMessage.setCcRecipient(mCC)
oMailMessage.setBccRecipient(mBCC)
oMailMessage.setSubject(mSubject)
oMailMessage.setAttachement(mAttachement)
oMailmessage.Body = mBody
oMailClient.sendSimpleMailMessage(oMailMessage,0)
End Sub
--
Liste abmelden mit E-Mail an: users+unsubscribe@de.libreoffice.org
Probleme? https://de.libreoffice.org/hilfe-kontakt/mailing-listen/abmeldung-liste/
Tipps zu Listenmails: https://wiki.documentfoundation.org/Netiquette/de
Listenarchiv: https://listarchives.libreoffice.org/de/users/
Datenschutzerklärung: https://www.documentfoundation.org/privacy
Context
- Re [de-users] Mailversand per Makro mit Simple Mail Message · OoOHWHOoO
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.