Digital Marketing

Send mails by bash script via ssmtp

Install sSMTP, for instance:

apt-get install ssmtp

Configure ssmtp:

sudo nano /etc/ssmtp/ssmtp.conf

· Server: mailhub=smtp.1und1.de:587

· Hostname: hostname=subdomain.domain.com

· User: AuthUser=user@domain.com

· Pass: AuthPass=your_password

Then in your sh file, do what you need and pipe it to mail, for instance:

#!/bin/bash
mailx -s "Test report" service@goyun.info < /dev/null

Comments

Popular posts from this blog

Fixed WSL sshd: no hostkeys available -- exiting

PowerMTA pmta command

How to fix: mv: failed to preserve ownership