Thanks
gkontos and
ShelLuser for the replies! I'm by no means an email expert or even beginner systems administrator but have been playing around with the VPS a bit more and wanted to share my findings and hopefully get some corroboration on my understanding. In all of the scenarios below, I still have not associated my VPS with any type of registered or fully qualified domain name.
With the VPS using it's default hostname (
freebsd-xxx-xxxxx-xx
), if I simply send an email to my work email address using:
echo "email contents" | mail -s "test case 1" firstname.lastname@companyname.com
the email bounces back to my VPS and I get a message from the MAILER-DAEMON that essentially says:
Code:
<<< 553 #5.1.8 Domain of sender address <username@freebsd-xxx-xxxxx-xx> does not exist
501 5.6.0 Data format error
451 4.0.0 hash map "Alias0": missing map file /etc/mail/aliases.db: No such file or directory
What I think is happening is that while I'm able to successfully send out the email to my work address, my company's email server is rejecting delivery of the email because it can't validate the domain of the address (
freebsd-xxx-xxxxx-xx
) sending it.
However, using the same (default) hostname (freebsd-xxx-xxxxx-xx) if I try sending a message to my gmail account using
echo "email contents" | mail -s "test case 1" username@gmail.com
the mail is delivered successfully albeit to my spam folder, probably because gmail is a bit more liberal in it's policies than my company.
If I change my VPS hostname to
example.com
and try the same thing, the email shows up successfully in my Inbox at gmail but never shows up anywhere (not in my Inbox nor in my Junk folder) at my company email address. My guess here is that gmail is able to validate the example.com domain so it lets the email through to my inbox. Who knows what's going on with my company email server.
Finally, if I change my VPS hostname to
microsoft.com
, I can successfully send email to my work address inbox but it gets rejected by Google for violating Microsoft's
DMARC policy.
Takeaways
If I don't want to associate my VPS with a FQDN but still want to send external emails alerting me of things like available updates or completed cron jobs, I can do that, but I have to be careful in which email address such notices are sent to (e.g. I can send them to gmail as long as I check the Spam folder but I can't send them to my company email address).
Alternatively, I can try to pick a hostname that matches an existing domain name but have to be careful in which one I pick. I think this
Stack Exchange answer summarizes some of the pitfalls. I don't want to mess around with
/etc/resolv.conf or
/etc/hosts as described
here.
I guess the questions that I am left with are:
- what does something like
mail/ssmtp get me?
- what role does
mail/sendmail or
mai/postfix play in all of this?
Thanks again!