# email birthday reminder



## maik (Jul 21, 2020)

hi folks,

i am looking for a solution to get reminders for birthdays.
Having serious issues to remind myself to the dates and friends are getting pissed off.
So I tried with the calendar app on my "battery always empty phone" but the problem is, that it is not reliable enough, there is no alert, just a small indication at 9:00 which i often miss.

So I thought an email reminder thing would be awesome.
Since I am running a server anyway, that could be easy to implement.

Is there any package around or a project known which searches for a date and send an email at this date?

appreciate your help


----------



## zirias@ (Jul 21, 2020)

A simple script using date(1) and mail(1), executed daily from cron, comes to mind... e.g. you could have files named like `07-21` for July, 21st and use `date -I | cut -d- -f2-3`.


----------



## Mjölnir (Jul 21, 2020)

RTFM mail(1) & calendar(1), call it daily by your crontab(5) with your birthday text file (templates: /usr/share/calendar).  A more sophisticated solution is to use e.g. KDE PIM suite (kde/kontact), it can remind you a week before or s/th like that.  But you can do that with the simple sulution as well: insert two items, a reminder a week before and the real birthday.


----------



## maik (Jul 21, 2020)

since i have not done any scripting, I actually hope there is already something documented for a non desktop environment.

doing freestyle like zirias mentioned would be the last option for me.


----------



## Mjölnir (Jul 21, 2020)

All the parts you need are there since decades & very well documented.  You already started _communication_. All you need is the last three XP principles: _simplicity, feedback & courage_. `pkg search remind``pkg rdesc remind`.  Back to the home-grown simple solution:
`calendar -A 7 -f calendar.australia` shows no output, but `calendar -A 7 -f calendar.german` does. Thus
`sh -c 'if [ -n $(calendar -A 7 -f calendar.australia) ]; then echo no; else echo yes; fi'` gives "no" but in the german calendar there's a matching date so it echoes "yes".  Now you have the start of your sh(1) script to call from your crontab(5).

```
#!/bin/sh
#
# ~/bin/remind.sh - e-mail reminder to be called from crontab(5)
# put reminders in ~/.calendar/calendar (format like /usr/share/calendar/*)

CAL_CMD='calendar -A 7'

if [ -n "$(${CAL_CMD})" ]; then
    ${CAL_CMD} | mail -s 'automagic reminder' me@localhost
fi
```


----------



## maik (Jul 21, 2020)

thanks for this, will try it out within the next days

may I ask where I can find documentation of the mentioned packages?
Tried to google it but couldn't really find something


----------



## kpedersen (Jul 21, 2020)

```
$ sleep 6829112 && echo "Happy Birthday kpedersen!"
```

*Note:* If you still need to actually use your computer whilst you are waiting for my birthday, then perhaps run it in tmux.


----------



## Mjölnir (Jul 21, 2020)

maik said:


> thanks for this, will try it out within the next days
> 
> may I ask where I can find documentation of the mentioned packages?
> Tried to google it but couldn't really find something


`pkg alias`

```
ALIAS ARGUMENTS
all-depends 'query %dn-%dv'
all-rdepends 'rquery %dn-%dv'
annotations 'info -A'
build-depends 'info -qd'
cinfo 'info -Cx'
comment 'query -i "[%C/%n] %c"'
csearch 'search -Cx'
desc 'query -i "%e"'
download 'fetch'
iinfo 'info -ix'
isearch 'search -ix'
leaf 'query -e '%#r == 0' '%n-%v''
license 'query "%l: %L"'
list 'info -ql'
provides 'query "[%n-%v] %b"'
provides-all 'query -a "[%n-%v] %b"'
rprovides 'rquery "[%n-%v] %b"'
rprovides-all 'rquery -a "[%n-%v] %b"'
message 'query '[%C/%n] %M''
noauto 'query -e '%a == 0' '%n-%v''
options 'query -i "%n - %Ok: %Ov"'
origin 'info -qo'
prime-list 'query -e '%a = 0' '%n''
prime-origins 'query -e '%a = 0' '%o''
provided-depends 'info -qb'
rall-depends 'rquery %dn-%dv'
raw 'info -R'
rcomment 'rquery -i "[%C/%n] %M"'
rdesc 'rquery -i "%e"'
required-depends 'info -qr'
rinfo 'rquery -i "%c"'
rlicense 'rquery -i "%l: %L"'
rmessage 'query -i "[%C/%n-%v] %M"'
roptions 'rquery -i "%n - %Ok: %Ov"'
shared-depends 'info -qB'
show 'info -f -k'
size 'info -sq'
```
`pkg rdesc remind`
For the UNIX utilities, see any book or RTFM your systems man pages.
Standard disclaimer: install the docs: `pkg install {de,en}-freebsd-doc`, replace _de_ with your native tongue, and point your favorite browser to /usr/local/share/doc/freebsd.
You can add to the alias section of /usr/local/etc/pkg.conf

```
message: "query '[%C/%n] %M'",
  rmessage: query -i "[%C/%n-%v] %M",
```
 and read through all `pkg message|less`.


----------



## tingo (Jul 22, 2020)

misc/birthday is in ports, if you want a ready-made solution. You'll have to set up the cronjob yourself.


----------



## Mjölnir (Jul 22, 2020)

since cron(8) can handle to send mail iff the cron job has any output, you can simplify the above even more: put in your crontab(5) (invoke `setenv EDITOR ee; crontab -e` or `crontab filename`)

```
MAILTO=me@doma.in
* 8 * * *       calendar -A 7
```


----------



## maik (Jul 24, 2020)

I could not get it working, so I stopped ripping out my hair and just used nextclouds calendar

anyway, thanks for your feedback.


----------



## Mjölnir (Jul 25, 2020)

The only two reasons for such a simple (but maybe elegant) solution not to work are

you have no working e-mail MTA
typo in your ~/.calendar/calendar file
Now _the cloud_ has even more of your personal data.


----------



## maik (Jul 26, 2020)

mjollnir said:


> The only two reasons for such a simple (but maybe elegant) solution not to work are
> 
> you have no working e-mail MTA
> typo in your ~/.calendar/calendar file
> Now _the cloud_ has even more of your personal data.


appreciate your thinking, I am a fan of privacy, so I hope the self hosted Nextcloud instance is not transferring data.

anyhow my biggest issue is just that I need someone to take my hand and help me with the commands and the relation (connection) between to different applications.
I tried to read thru myself but I have issues reading stuff for hours and keep the knowledge over time.


----------



## hruodr (Jul 30, 2020)

I call calendar in .tcsh and have template .calendar/calendar with
empty and filled entries for each day of the form:



> 1/3     %
> 1/3     %
> 1/3     %
> 
> ...



Then, I do minimal editions to my calendar when necessary. This way I avoid errors in the file.
I will soon change the method and include a file with the filled entries that are identical each year.

Then you must pay attention after each login, after each xterm you open.


----------

