Setting up emailersCreated on 2016/10/20,
We’ll gather in this page various configuration tips and tricks for having emails work on various systems.
This tutorial specifically shows how to configure a FreeBSD system to use a Gmail account for its sendmail calls. It replaces the default sendmail client with sSMTP.
With that said, the settings used for Gmail can easily be replaced for any other email service, including your own.
Update FreeBSD Ports Tree:
portsnap fetch update
Disable Default Sendmail:
You can disable Sendmail by adding the following lines to the file /etc/rc.conf:
sendmail_enable="NO" sendmail_submit_enable="NO" sendmail_outbound_enable="NO" sendmail_msp_queue_enable="NO"
After this you can reboot or you can kill sendmail manually with the following command:
Install sSMTP port:
cd /usr/ports/mail/ssmtp/ && make install
Next, you need to create a configuration file for sSMTP:
Add the following:
root=<your_email> mailhub=smtp.gmail.com:587 AuthUser=<your_email> AuthPass=<your_password> UseSTARTTLS=YES
Create a txt file “message.txt” with the following text:
To: firstname.lastname@example.org From: email@example.com Subject: Testmessage This is a test for sending
Where firstname.lastname@example.org is your current or second email to get the test email. Run the following command:
ssmtp -v email@example.com < message.txt
After this you will get a text output confirming your mail was sent. If there were no errors, then you can verify it worked by checking firstname.lastname@example.org
If you get errors however, double-check the sSMTP config.
Replace sendmail with sSMTP:
This makes sSMTP the default mailer for the system (i.e. replaces all calls for sendmail).
mv /usr/sbin/sendmail /usr/sbin/sendmail.org
ln -s /usr/local/sbin/ssmtp /usr/sbin/sendmail
Make sure that mail is working by using the following command:
mail -v -s "test subject" email@example.com
To change the name in which e-mail comes from:
The chpasswd tool uses vi as its text editor. If you don’t know how to use it, you can visit Colorado State’s reference sheet.
Once the file is opened, find the user’s full name, it will look something like this:
Full Name: World Wide Web Owner
Change the full name::
Pydio From Example.com
Use the default sendmail setup and it should work as expected.