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 = "hanswernerher...@t-online.de"
mSubject = " Test, Test, Test ..."
mCC = Array("ooohwh...@t-online.de","hanswernerher...@t-online.de")
mBCC = Array("ooohwh...@t-online.de","hanswernerher...@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+unsubscr...@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

Antwort per Email an