I installed Jenkins and configured it to send emails as being sent from "jenkins@jenkins.example.com" but the address is always changed when email is being sent and I receive the mail as being sent from "jenkins@default.vps.example.com".

I've installed Sendmail and Jenkins is configured to use as mail server.

Any idea why Sendmail replaces the FROM domain when email is being sent?

The hostname of the server is properly set (when I run hostname I do get "jenkins.example.com").

Same way if I send an email from command line echo "This is the body" | mail -s "Subject" u@d.com

From where does it take this default.vps.example.com domain? Where is this default domain configurable?

LE: in my sendmail.mc I have define(confDOMAIN_NAME', jenkins.domain.com')dnl and I generated the sendmail.cf file m4 sendmail.mc > sendmail.cf and restarted sendmail. Still doesn't work.


ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
Enter <ruleset> <address>
> canonify           input: jenkins @ jenkins . example . com
Canonify2          input: jenkins < @ jenkins . example . com >
dns_getcanonname(jenkins.example.com, trymx=1)
dns_getcanonname: trying jenkins.example.com. (AAAA)
dns_getcanonname: trying default.vps.example.com. (AAAA)
    NO: errno=0, h_errno=4
dns_getcanonname: trying default.vps.example.com. (A)
dns_getcanonname: default.vps.example.com
Canonify2        returns: jenkins < @ default . vps . example . com . >
canonify         returns: jenkins < @ default . vps . example . com . >
  • Maybe this answer is of use. – HBruijn Oct 21 '15 at 10:15
  • See my edit. Already did this and still doesn't work. – daniels Oct 21 '15 at 10:19

Quite likely your sendmail replaces names with DNS CNAME record (DNS alias) with "true names".

As root execute echo '3 jenkins@jenkins.example.com' | sendmail -d8.20 -bt
It should show you DNS queries during email address preprocessing (by rule set 3).


D. J. Bernstein
CNAME records in mail
RFC 821 prohibited all use of ``nicknames or aliases'' in domain names in SMTP requests. RFC 1123 specifically prohibited DNS aliases (domains with CNAME records) in MAIL and RCPT requests.
sendmail accepts a domain with a CNAME record. It replaces the domain with the CNAME value before using it in RCPT, unless it is acting as a dumb client. Similar comments apply to qmail and other mailers.

  • I updated my question with the output. So it looks like for jenkins.example.com it only finds (AAAA) while for the default/initial hostname default.vps.example.com it finds both (AAAA) and (A) and in the end it decides to use default . vps . example . com. Any idea why? – daniels Oct 21 '15 at 13:53
  • So it must be as you said that it replaces the CNAME with the "true" default name... Any idea what can be done to stop it from doing this? Or to configure it to use the CNAME instead? – daniels Oct 21 '15 at 13:56
  • It trivial to stop YOUR sendmail to replace CNAMEs with "real names" [see DontExapndCnames] but sendmails/MTAs beyond your control will do it. – AnFi Oct 21 '15 at 15:17

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.