How do I install sendemail on vyos 1.2 or another mechanism to send email

Hi Team,

Is there a way to install sendEmail package on Debian 8 or if not is there any alternate way to send emails from vyos? I need to send an email if the tunnel goes down.

TIA
Blason R

How about; monitor with SNMP and let your monitoring software send an email?

I think it can be good to have the option for the VyOS box to send out emails when needed.

If sendmail isnt available today I would recommend to file that as a feature request over at https//vyos.dev (let me know if you for whatever reason dont want to create that request on your own).

A workaround would be to let python send the email - python3 is installed but I dont know if the modules needed to send email through python are installed aswell.

I agree that built in SMTP MTA support (sendmail, Postifx, or other) would be great. That being said, I do this little bit of jank in my WAN load-balancing hook (Bash script) to send email alerts:

DATE_UTC=`date +'%a, %-d %b %Y %H:%M:%S %z'`
EMAIL="ehlo mydomain.xyz
MAIL FROM: <me@mydomain.xyz>
RCPT TO: <someone@mydomain.xyz>
DATA
From: <me@mydomain.xyz>
To: <someone@mydomain.xyz>
Date: "$DATE_UTC"
Subject: Some Subject

Some message content...
.
quit
"
echo "$EMAIL" | nc -w 5 -N smtp.mydomain.xyz 25 >/dev/null
1 Like

You download and manually install (dpkg -i ) packages into Vyos.

Note two things:

  1. This is fully unsupported
  2. The package will exist only on your current running version. If you add a new system image or boot a different system image, you have to re-add the package etc.

@JeffWDH That’s quite the clever hack :slight_smile:

Would it be bad to suggest that as a workaround for lack of sendmail binary in the VyOS image?

That is having /usr/bin/sendmail be a symlink to a shell-script (as posted by @JeffWDH) that just takes from, to, subject and bodytext according to the syntax of the real sendmail binary?

Would save some space by not having to have the full postfix or whatever gets dragged along if the sendmail package is installed during compile of the image?

So it does not work like that and can not install sednemail or no provision to send an emails from device.

This is the first thing I tried but then sendemail package has so many perl dependencies hence it does not work that out.

Yes but I was thinking if we could create a shell-script based on @JeffWDH example that can take the same syntax and input as the sendmail binary.

Since that will just use netcat (nc) to “fire and forget” when attempting to send an email?

Of course the errrorhandling and ability to queue emails etc is nonexistent with such workaround but would hopefully solve 99% or so of the needs for those who want ability to send an email by just calling /etc/bin/sendmail in VyOS ?

This looks pretty lightweight, perhaps this could be included? It would be a little more robust and support TLS, etc.

https://marlam.de/msmtp/

https://wiki.debian.org/msmtp

Thanks let me give a try

I have created a task as feature request:

https://vyos.dev/T5730

3 Likes