Page 1 of 1
[Solved] Send email macro
Posted: Tue Apr 20, 2021 3:41 pm
by Nelomf
Hello
This problem is not related directly with the macro but her it goes.
I do need help
I' sending a email through a OpenOffice basic macro. The default email program is Thunderbird
I use this in several PC's and normally after the code a prompt appear that says "Another application is trying to send mail using this user profile. Do you want to send the email?".
If i press OK the mail goes but in one PC i clicked to not show the warning and i cant send the email.
I want to:
or show again the warning
or even better bypass and always allow sending this email.
Is it possible
Thanks.
Manuel
Re: Send email macro
Posted: Tue Apr 20, 2021 8:32 pm
by Zizi64
Please upload your macro code here.
Re: Send email macro
Posted: Tue Apr 20, 2021 10:26 pm
by Villeroy
Why buttons and macros to send mails?
Re: Send email macro
Posted: Wed Apr 21, 2021 8:56 am
by Nelomf
God Morning
My macro
Note: It works perfectly on some PC's and others don't and the only problem (I think) it's Thunderbird setup.
Code: Select all
Sub Comprasemail
Rem constroi PDF
mypdf
rem define nome do bar no sujeito do email
xSheet = ThisComponent.Sheets(1)
oCell = xSheet.getCellByPosition(1,0)
rem define data de envio do email
Dim basDate As Date
basDate = NOW()
rem enviar email
ThisComponent.store()
rem ----------------------------------------
sPathPDFs = "c:\encomendas\"
eMailAddress = "sede@ccdgondomar.pt"
eSubject ="F. encomendas"&" " & "de"&" " & oCell.string &" "&"enviada em"&" "& Day(basDate)&"/" &Month(basDate) &"/" &Year(basDate)
eBodyText = "Em anexo pode encontrar a minha encomenda da semana"
URL1 = convertToUrl(sPathPDFs & "encomenda.pdf")
rem URL2 = convertToUrl(sPathPDFs & "compras.pdf")
ArrayOfURLs = Array(URL1)
rem ----------------------------------------
eMailer = createUnoService("com.sun.star.system.SystemMailProvider")
eMailClient = eMailer.queryMailClient()
eMessage = eMailClient.createMailMessage()
eMessage.Recipient = eMailAddress
rem eMessage.BlindCopy = BCAdresses ' ??
eMessage.Subject = eSubject
eMessage.Body = eBodyText ' ??
eMessage.Attachement = ArrayOfURLs
eMailClient.sendMailMessage ( eMessage,com.sun.star.system.MailClientFlags.NO_USER_INTERFACE )
msgbox "A Sua encomenda foi enviada com exito"
ThisComponent.close(True)
End Sub
Re: Send email macro
Posted: Wed Apr 21, 2021 9:47 am
by Nelomf
Villeroy wrote:Why buttons and macros to send mails?
Because this sheet is intended to people that have very little understanding of software, they only place some numbers in a predefined table and then press a send button.
It's very easy for them to work this way.
The macros in this sheet filters the content of the sheet, save as pdf and send to me.
That's why.
Tanks
Re: Send email macro
Posted: Wed Apr 21, 2021 11:38 am
by Villeroy
Nelomf wrote:
Because this sheet is intended to people that have very little understanding of software
This is the best reason to avoid any kind of spreadsheet. I never see any spreadsheet when something is easy to use. I see spreadsheets as applications mockups for drafting and easy development. With a few keystrokes, with copy&paste or drag&drop all your references, validations, formattings are futile. Easy to make is opposed to easy to use and vice versa.
Re: Send email macro
Posted: Thu Apr 22, 2021 12:55 pm
by Nelomf
Solved
I've installed in some computers a 64bit version of thunderbird and shoud be a 32 bit.
It works fine.
I will also try to set mapi.blind-send.enabled = to true or false to see if the message (Allow from external program...)appear or not.
~
Finally a question. Is it possible to close thunderbird (from the macro) after the mail goes out.
Thanks
Re: Send email macro
Posted: Thu Apr 22, 2021 12:58 pm
by Nelomf
Villeroy wrote:Nelomf wrote:
Because this sheet is intended to people that have very little understanding of software
This is the best reason to avoid any kind of spreadsheet. I never see any spreadsheet when something is easy to use. I see spreadsheets as applications mockups for drafting and easy development. With a few keystrokes, with copy&paste or drag&drop all your references, validations, formattings are futile. Easy to make is opposed to easy to use and vice versa.
It's your opinion, i respect but dont agree.
Thakns