
This feature allows you to send e-mails either directly over the Internet or to transfer to another SMTP server such as Exchange or Office 365. $ echo -e "Hey archuser.In this tutorial, we will see how to set up an SMTP server with Windows Server. You can then pipe messages into mail instead of into sendmail. Hit Ctrl+ d on a blank line to end your message and automatically send it out.Īn alternate method for sending emails is to create a text file and send it with ssmtp or mail test-mail.txt Test Note: When using mail interactively, after typing the Subject: subject and other headers, hit enter twice, and then type the body. $ echo -e "Subject: this is the subject\n\nthis is the body" | mail interactively as: There is no reason to add yourself or other users to the mail group. The /usr/bin/ssmtp binary runs as the mail group and can read this file. By default, the entire /etc/ssmtp directory is accessible only by root and the mail group. Mainuser:x:1000:1000:mainuser at myhost,:/home/mainuser:/bin/bash Securityīecause your email password is stored as cleartext in /etc/ssmtp/nf, it is important that this file is secure. $ grep myhost /etc/passwd root:x:0:0:root at myhost,:/root:/bin/bash $ echo -e 'Subject: test\n\nTesting ssmtp' | sendmail -v the 'From' text by editing /etc/passwd to receive mail from 'root at myhost' instead of just 'root'. etc/ssmtp/revaliases test whether the Gmail server will properly forward your email: If it is not working as expected read the man page ssmtp(8), please.Ĭreate aliases for local usernames (optional)

Note: Take note, that the shown configuration is an example for Gmail, You may have to use other settings. # Email 'From header's can override the default domain? TLS_CA_FILE=/etc/ssl/certs/ca-certificates.crt When using port 587, change UseSTARTTLS=Yes Must be correctly formed, fully qualified domain name or GMail will reject connection. # The address where the mail appears to come from for user authentication. # The user that gets all the mails (UID < 1000, usually the The mail server (where the mail is sent to), both port 465 or 587 should be acceptable You can do so on your Less Secure Apps page.

You can do so on your App Passwords page. If your Gmail account is secured with two-factor authentication, you need to generate a unique App Password to use in nf.To configure sSMTP, you will have to edit its configuration file ( /etc/ssmtp/nf) and enter your account settings. Reason: The access to lesssecureapps is no longer possible without two-factor authentication.
