Solved Not getting root email, after ssmtp install

Hello, first post here. I was completely new to BSD having been a Windows/GUI guy since I was young. I built a box to replace an aging Windows Home Server V1. So far, it's been a test but I'm super happy with the "it just works" nature of FreeBSD.

Issue
I want to get system email, periodic updates (daily/weekly/monthly) to an external email. I installed ssmtp and followed several threads/blog posts/man pages to get that done. This was a step in the path towards getting periodics and SMART data emailed each day, and now I'm stuck.​
  • At this point: mail -s "test email" myemail@gmail.com works and the email shows up within a few seconds.
  • mail -s "test email" root does not work and no email shows up.
  • mail -s "test email" josh does not work (josh is my low level user)
  • periodic daily takes some time, but never is received in my email inbox either.
  • I can send out email, but email to root doesn't work (from what I can tell).
Info Sources I've followed
Modified Files
in /usr/local/etc/ssmtp/ssmtp.conf
Code:
#per btt.red freebsd gmail for outgoing mail
root=josh@southbendsd.com
mailhub=smtp.gmail.com:587
rewriteDomain=gmail.com
UseTLS=YES
UseSTARTTLS=YES
AuthUser=sending_email@gmail.com #email I'm sending email from
AuthPass=passwd_here  #passwd removed for forum
FromLineOverride=YES
AuthMethod=LOGIN
in /usr/local/etc/ssmtp/revaliases
Code:
# sSMTP aliases
#
# Format:       local_account:outgoing_address:mailhub
#
# Example: root:your_login@your.domain:mailhub.your.domain[:port]
# where [:port] is an optional port number that defaults to 25.
root:sending_email@gmail.com:smtp.gmail.com:587
josh:sending_email@gmail.com:smtp.gmail.com:587
in /etc/rc.conf
Code:
#configure email to gmail
sendmail_enable="NO"
sendmail_submit_enable="NO"
sendmail_outbound_enable="NO"
sendmail_msp_queue_enable="NO"
in /etc/mail/mailer.conf
Code:
# $FreeBSD: releng/10.1/etc/mail/mailer.conf 93858 2002-04-05 04:25:14Z gshapiro $
#
# Execute the "real" sendmail program, named /usr/libexec/sendmail/sendmail
#
#sendmail       /usr/libexec/sendmail/sendmail
#send-mail      /usr/libexec/sendmail/sendmail
#mailq          /usr/libexec/sendmail/sendmail
#newaliases     /usr/libexec/sendmail/sendmail
#hoststat       /usr/libexec/sendmail/sendmail
#purgestat      /usr/libexec/sendmail/sendmail

#updated settings from btt.red for ssmtpd external email
sendmail /usr/local/sbin/ssmtp
send-mail /usr/local/sbin/ssmtp
mailq /usr/libexec/sendmail/sendmail
newaliases /usr/libexec/sendmail/sendmail
hoststat /usr/libexec/sendmail/sendmail
purgestat /usr/libexec/sendmail/sendmail
in /var/logs/maillog
Output from working and not working mail calls look the same. As an example
Code:
Mar 15 10:30:56 bsdserver sSMTP[3501]: Creating SSL connection to host
Mar 15 10:30:57 bsdserver sSMTP[3501]: SSL connection using ECDHE-RSA-AES128-GCM-SHA256
Mar 15 10:31:01 bsdserver sSMTP[3501]: Sent mail for sending_email@gmail.com (221 2.0.0 closing connection g9sm5130739igg.1 - gsmtp) uid=0 username=root outbytes=401
in /etc/aliases
modified the following lines
Code:
# root: me@my.domain
#added below during ssmtp configuration to get external mail
  root: receive_email@gmail.com
I'll send additional details as you might need. I'm stuck and can't figure out where to go from here. Thanks for any help in advance.
 
Last edited by a moderator:
Look in your spam folder for gmail to make sure it's not winding up there.
I did that. Sorry I forgot to put that in the above post.

Another thought... am I correct that ssmtp doesn't use a daemon so there is no service to restart or need to reboot after modifying settings? I'm thinking like with Samba where I had to restart the service after config changes. I've rebooted before making this post, but its something I was thinking about.
 
Last edited by a moderator:
I'm not sure if you'd have to restart the daemon or not, but it's a simple thing to do. You shouldn't have to reboot.

I haven't used ssmtp in a long time, and when I did, I used roadrunner which didn't, at least at the time require authorization to send out.

rather than aliasing root to me@mydomain in /etc/aliases, though, I would just have it be
Code:
root: me
rather than me@mydomain.

The other thing was that when I did use ssmtp, the email address I was using for root would be whatever ISP I was using for the mailhub as well--that is, if I was using the mydomain.com smtp server, the root alias in ssmtp.conf would be john@mydomain.com. I have NO idea if that could cause an issue with ssmtp though.
 
Well... I mostly feel like a moron. I've got a system of sub email addresses (like many people) and forward them all to one main one I use. I didn't want to plaintext the password for my main account so I was sending all this through a sub account. This just works 99.99% of the time. I hadn't actually logged in to the sub account. Every email since I set-up ssmtp was in there. I've hit this problem before where Google just won't forward some messages based on headers, and usually when linked to the same account owner. Ugh. I've modified it and am now sending it to my main address. For security, I'll follow the wiki article on locking down ssmtp permissions (http://wiki.freebsd.org/SecureSSMTP). Thanks for the help you guys.

Once again, I'm amazed how BSD just works...and it's something else that is the problem. Even in my short time with FreeBSD, this isn't the first time this has happened. I'm sure this won't be my last issue, but I'm impressed by the responsiveness of the community.

Thanks again.
 
This isn't actually FreeBSD. It's a third party port, but yes, a great many things in FreeBSD do just work, and often (many times thanks to wblock@) there's excellent documentation about it.
 
Back
Top