Send email without prompt

Good Morning,

I am using the example give from
Sending Email from Base with multiple attachments - English - Ask LibreOffice

Here is my code:

Sub SendEmail
Dim eMailer as Object
Dim eMailClient as Object
Dim eMessage as Object
Dim sOnderwerp as String
Dim sBody as String

	eMailer = createUnoService ("com.sun.star.system.SimpleSystemMail")
	eMailClient = eMailer.querySimpleMailClient()
	eMessage = eMailClient.createSimpleMailMessage()
	sOnderwerp = "please confirm receipt"
	sBody = "this is a test"
	eMessage.Body = sBody
	eMessage.SetRecipient("workmail")
	eMessage.setSubject(sOnderwerp)
	eMessage.setAttachement(Array("K:\temp_pathway\TABLE_EXPORT.ods"))
	eMailClient.sendSimpleMailMessage(eMessage,	com.sun.star.system.SimpleMailClientFlags.NO_USER_INTERFACE)
End Sub

Here is the prompt.

Microsoft Outlook 
A program is trying to send an e-mail message on 
your behalf. If this is unexpected, click Deny and verify 
your antivirus software is up-to-date. 
For more information about e-mail safety and how 
you might be able to avoid getting this warning, 

Is there a way to avoid this prompt?

2 Likes

I accept this as a solution, however this definitely will be a problem since Outlook security is controlled by my company’s IT security department.

Well… the Outlook security settings are not the problem here; rather, a “policy” of your company’s IT security department of not keeping the antivirus up to date. Note that the first (and the preferred) solution there is just make Outlook happy with working and updated AV. Otherwise, Outlook would warn on each programmatic send mail action, be it from LibreOffice, or from MS Office, or - maybe from a trojan sneaked into your system and trying to send mails on your behalf.