

Moderators: Lodahl, LarsBrandi
Code: Select all
Sub SendMail
Dim aAttachement(0) As String
oModtager = "jens@mail.dk"
oEmne = "Her er mit regneark"
aAttachement(0) = ConvertToURL(ThisComponent.URL)
Tilstand = 0 '0-åbner mailen før afsendelse, 1-sender mailen omgående
Call subSendMail(oModtager,oEmne,aAttachement(),Tilstand)
End Sub
Sub subSendMail(oModtager As String,oEmne As String,aAttachements,Tilstand As Integer)
oMailer = createUnoService( "com.sun.star.system.SimpleSystemMail" )
oMailClient = oMailer.querySimpleMailClient()
oMessage = oMailClient.createSimpleMailMessage()
oMessage.setRecipient( oModtager )
oMessage.setSubject( oEmne )
oMessage.setAttachement( aAttachements() )
oMailClient.sendSimpleMailMessage(oMessage,Tilstand)
End Sub