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

Sender email address does not appear to be treated the same way for the envelope level as it is for email headers #126

Open
atc0005 opened this issue Jul 30, 2020 · 0 comments

Comments

@atc0005
Copy link

atc0005 commented Jul 30, 2020

Let's assume that the system is named cheetah.

It appears that the logic used to replace root@localhost with root@cheetah works as intended for the email headers, but does not apply to the address used as the sender address (the envelope) when sending the email message.

This code:

yum/yum-cron/yum-cron.py

Lines 244 to 247 in f8616a2

username, at, domain = self.opts.email_from.rpartition('@')
if domain == 'localhost':
domain = self.opts.system_name
msg['From'] = '%s@%s' % (username, domain)

appears to replace root@localhost with root@cheetah and store the result in domain. The domain variable is then used here:

msg['From'] = '%s@%s' % (username, domain)
to form msg['From'].

We can see here:

s.sendmail(self.opts.email_from, self.opts.email_to, msg.as_string())

that the msg type is converted to a string to form the complete email headers/body (I may be butchering this description) as the last argument to the s.sendmail() call.

The first part of the s.sendmail() call appears to use the email_from value as-is without any conversion, so if the configuration has root@localhost, then this is used as-is for the first argument in the s.sendmail() function call.

Is this intentional?

Looking here:

yum/etc/yum-cron.conf

Lines 33 to 36 in f8616a2

[emitters]
# Name to use for this system in messages that are emitted. If
# system_name is None, the hostname will be used.
system_name = None

and here:

yum/etc/yum-cron.conf

Lines 50 to 59 in f8616a2

[email]
# The address to send email messages from.
# NOTE: 'localhost' will be replaced with the value of system_name.
email_from = root@localhost
# List of addresses to send messages to.
email_to = root
# Name of the host to connect to to send email messages.
email_host = localhost

I don't see this behavior documented as intentional.

Is this a documentation problem or is the s.sendmail() function call intended to be called this way:

            s.sendmail(msg['From'], self.opts.email_to, msg.as_string())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant