I am trying to send mail directly from Calc.
I am using the below code (got this code from Oo forum)
Code is working fine when cell "H3" contains English Text. But when I am trying to send other language (Bengali in my case) receiver is getting ????? (question marks) in his mail box.
How to solve that issue.
In the 90ies StarOffice had its own mail client. This decades old service may not support unicode.
LibreOffice seems to have modernized these services. At least they are renamed and modified somehow.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
from smtplib import SMTP
from email.mime.text import MIMEText
loginname = '....'
password = '....'
server = 'mail.some_provider.org'
me = 'my_name@some_provider.org'
subject = 'test germän umlauts'
def sendmail(*_):
doc = XSCRIPTCONTEXT.getDocument()
sel = doc.CurrentSelection
msg = sel.String
print( msg )
# prints:
# `hallölele {}`
message = MIMEText(msg.format(me ))
message['Subject'] = subject
message['From'] = me
message['To'] = me
with SMTP(server) as mailserver:
mailserver.login(loginname, password)
mailserver.send_message(message )
AOO4, Libreoffice 6.1 on Rasbian OS (on ARM) Libreoffice 7.4 on Debian 12 (Bookworm) (on RaspberryPI4) Libreoffice 7.6 flatpak on Debian 12 (Bookworm) (on RaspberryPI4)