1

Gentoo – SSMTP (Sending Mail)

Now that I finished showing you how to set up your LAMP server you are probably going to want to set up sendmail/ssmtp so that some of your new fancy websites can take advantage of it for their email services. Lets get started!

We are going to be using ssmtp which will replace sendmail as the MTA for the server. So as root type

Once that completes we need to edit two config files.

Type and edit the following lines to reflect your email settings.

(Settings for a regular email account)

(Settings for a gmail account)

Once you are done editing /etc/ssmtp/ssmtp.conf save the file and exit. Then type and press enter to edit the following lines.

(Settings for a regular email account)

(Settings for a gmail account)

When you are done save the file and exit. What this did was set up accounts for root and your main user to use to send emails from. Now we need to install mailx which will be used when sending emails from the server. So as root type

Now we need to create a symlink from ssmtp to sendmail since sendmail has been replaced by ssmtp but some packages still like to use sendmail to send well mail! So as root do the following:

  • Type
  • Type to create the symlink, that’s it!

Now lets test the new mailer. As root do the following:

  • Type (where test@domain.com is the email address you want to send to)
  • You should now see Subject: , type your subject and press enter.
  • You will now have a blank area, this is your email body, just start typing your email, when done press to send the email.
  • You will now see Cc: displayed, if you wish to copy the email to someone enter that address now otherwise just hit enter and the email will be sent.

Now you need to add you regular user to the ssmtp group by using the command: Also note that if you want the ability to send emails through a website using php you will need to add the user apache to the ssmtp group by doing:

Congratulations! Your server can now send mail, and you can also send emails directly from your terminal using mailx.