Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAILFROM should probably substitute variables #26

Closed
lkraav opened this issue Dec 17, 2018 · 9 comments · Fixed by #61
Closed

MAILFROM should probably substitute variables #26

lkraav opened this issue Dec 17, 2018 · 9 comments · Fixed by #61

Comments

@lkraav
Copy link

lkraav commented Dec 17, 2018

#17 (comment)

Because hardened mail servers will refuse to accept mail without authentication, it would make sense to provide MAILFROM with the ability to substitute at least $USER variable.

Global configuration MAILFROM=cron+$USER@server resulting in cron+maria@server e-mail would be more clear than just cron@server.

@t8m
Copy link
Member

t8m commented Dec 18, 2018

PRs welcome

@lkraav
Copy link
Author

lkraav commented Dec 18, 2018

My personal C-fu is definitely not strong enough to get this done anywhere near "quickly". Have to look into outsourcing.

@t8m t8m added the enhancement label Apr 8, 2019
@thisHermit
Copy link

I am interested in working on it. Is it still relevant?

@lkraav
Copy link
Author

lkraav commented Jan 19, 2020

I am interested in working on it. Is it still relevant?

I'm definitely still interested in reaching this feature.

@thisHermit
Copy link

Hi @lkraav. I am a bit new to open source. So I didn't understand what you mean.

Do you intend to work on it or are you encouraging me to work on it?

@lkraav
Copy link
Author

lkraav commented Jan 22, 2020

Ecnouraging you. I'm still very weak at C, as all my time is spent in scripting languages.

@fcappi
Copy link
Contributor

fcappi commented Jun 18, 2020

Hi, as @lkraav I'm also interested in this feature.

@thisHermit are you still willing to work on this? If not, let me know and I can go ahead and implement it.

Thanks!

@thisHermit
Copy link

Go ahead.

fcappi added a commit to fcappi/cronie that referenced this issue Jun 19, 2020
fcappi added a commit to fcappi/cronie that referenced this issue Jun 19, 2020
@t8m t8m closed this as completed in #61 Jul 23, 2020
t8m pushed a commit that referenced this issue Jul 23, 2020
* Expand MAILTO and MAILFROM environment variables
* Update man pages about the MAILTO and MAILFROM variables

Fixes #26

Signed-off-by: Fernando Cappi <[email protected]>
@fcappi
Copy link
Contributor

fcappi commented Jul 23, 2020

Hi,

Now you can use environment variables(Using ${} or $ format) as part of MAILFROM and MAILTO. See the example below.

Environment variable:

[root@4e02e521cbe0 /]# env
HOSTNAME=4e02e521cbe0

crontab:

[root@4e02e521cbe0 /]# crontab -l
MAILTO=root-mailto@${HOSTNAME}
MAILFROM=root-mailfrom@$HOSTNAME
* * * * * /bin/bash /development/cronie/test.sh

Email sent by cron:

b'From: "(Cron Daemon)" <root-mailfrom@4e02e521cbe0>'
b'To: root-mailto@4e02e521cbe0'
b'Subject: Cron <root@4e02e521cbe0> echo "$(date)" >> /development/cronie/output.txt'

The feature should be included on next package release. For now, you have to build the code from master branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants