I had similar issue where email generated from macro was creating a popup for user interaction while using setting of Linux Mint + Libreoffice + Evolution (and Thunderbird) where, any of following makes no difference in the Evolution / thunderbird behaviour
MailAgent.sendSimpleMailMessage(MailMessage, 0 ) OR MailAgent.sendSimpleMailMessage(MailMessage, 1 ) OR
eMailClient.sendSimpleMailMessage ( eMessage, com.sun.star.system.SimpleMailClientFlags.NO_USER_INTERFACE )
.... All opens window where we have to manually click SEND button
------ I find a solution which works for Linux Mint + Libreoffice -----
As I understand normal email clients on Linux does not allow to send email silently thus we need to install terminal email client " mutt " , then modify libreoffice macro to access Linux SHELL and send email using Bash Shell and Mutt
Ensure you have installed mutt set your user login authentication in ~/.mutt/muttrc
-----------------------------------------------------------------
Code: Select all
REM eMailClient.sendSimpleMailMessage ( eMessage, 0 ) ' Disabled As Its doesn't send silently in any setting anyways !
REM - Automatic Email without user interaction (silent email ONLY FROM LINUX USING MUTT)
Shell ("bash -c 'echo " & CHR(34) & eMailDraft & CHR(34) &_
+ " | mutt -s "& CHR(34) & eSubject & CHR(34)& " " &_
+ eMailTO_Linux & " -c " & eMailCC_Linux & " -b " & eMailBCC_Linux &_
+ " -a " & CHR(34) & Attachment_1 & CHR(34) & " " & CHR(34) & Attachment_2 & CHR(34) & " " & CHR(34) & Attachment_3 & CHR(34) &_
+ " && notify-send "& CHR(34) &" Email Sent - "& eSubject & CHR(34) &" || notify-send ""ERROR - Mail not sent"" && exit 0 '")
----------------------------------------------------------
Note all variables [ eMailDraft , eSubject, eMailTO_Linux , eMailCC_Linux, eMailBCC_Linux , Attachment_1 , Attachment_2, Attachment_3 ] are dim as string
Also note that ; Attachment_1 , Attachment_2, Attachment_3 are declared / fetched as ABSOLUTE PATH and not as URL
e.g. of absolute path :- Attachment_1 = "/home/kenneth/Documents/Test Sales Data.pdf"
If you are not using any of the mentioned variables please remove it appropriately from the shell option setting. Any BLANK variable will throw a bash shell error.
----------------------------------
For everyone's convenience I am attaching 2 files 1. Install_Configure_mutt.txt 2. Demo_Send_Silent_Email_Linux_Using_Mutt.ods
Read following instructions carefully and follow it precisely for emailing silently from Linux + Libreoffice + mutt
-------------------------------------
Attaching script Install_Configure_mutt.txt
1) save and RENAME file as -
2) make executable -
Code: Select all
chmod 755 ~/Install_Configure_mutt.sh
3) run file -
Opens terminal and provides instructions to follow.
4) Configure email credentials in muttrc (basic template already provided for AOL / YAHOO / GMAIL )
This configuration file is stored in location ~/.mutt/muttrc
You can open it anytime to update your email credentials.
5) Now open enclosed file Demo_Send_Silent_Email_Linux_Using_Mutt.ods
Here you can provide email address , attachment path and email draft in provided calc sheet cells (you can also derive the same with your suitable convenient formula )
6) There are 2 buttons "Send Email Linux Silent" will use mutt and "Send Email Linux User Interaction" will use your GUI email client to send your email
Silent Sending of email works only with Linux / OS where mutt is available.
In this demo file mutt flags like -c (for Cc email) -b (For Bcc email) -a (For Attachment path) are derived in the reference cell using the formula. This ready formatted strings prepared to work with mutt syntax are then used as variable "eMailTO_Linux" and "Attachment_1" in macro "SendEmail_Linux_Silent"
Give it a try !
Happy Silent Emailing ...