I have successfully created a working desktop file that send (one or more) attachments to thunderbird, with from, to fields and with, as a body, a file html. This is the file content:

[Desktop Entry]
X-KDE-Submenu=allega a

[Desktop Action SendToMailRcp]
Name=posta elettronica...
Exec=thunderbird -compose "attachment='$(echo %F | sed 's/\\ \\//,\\/\\//g')',to=[some-account],subject=[my-subject],message='path/to/myfile.html',from=[some-my-account]"

Now I'd like to add a function for the date, for inserting autmatically today date. I tried with javascript, but javascript is not working in e-mail; I tried with php (message='http://localhost/path/to/file.php'), but if I try to get a php file in thundebird body I don't get anything.

How can I, if possible, get the date in body message?

  • Do you mean the date as part of the mail headers (TB should add that automatically if missing), or do you want to put it into the body? date -R (or $(date -R) in your applied case) will give you the current date in standard format, where to go from there depends on where you need it. Jul 23, 2018 at 9:50
  • I mean put (the date) into the body. Thank you! Adding as you said "$(date -R)" I get the week day ("Mon"), I'd like to get day-month-year. A second problem: with your code I cannot see what follow the code (i.e. "\n partenza:")
    – Duns
    Jul 23, 2018 at 11:26
  • Using "body=arrivo: $(date) \n partenza:" I get the date, tough in format imperfect, but nothing after the code (no: " \n Partenza:")
    – Duns
    Jul 23, 2018 at 11:38
  • When I try to use $(date +"%d-%m-%Y") I get as "%d" not the day, but the current directory of the attachment, and as %m "--", only %Y works (2018). Can someone help me? Why this thunderbird's misunderstanding?
    – Duns
    Jul 23, 2018 at 15:19

1 Answer 1


Solved: this is the code (see my question above for the whole code): Exec=thunderbird -compose "attachment='$(echo %F | sed 's/\ \//,\/\//g')',to=[some account],subject=[some subject],body=arrivo: $(date "+%x") \n partenza:,from=[some account]"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.