You can install a fully featured mail transport agent (MTA) like Postfix for that, but this is a complex task that's made more complex in the face of barricades put up by other mail servers to fight spam. It makes more sense to install a very simple agent that in turn hands off the final delivery task to a professionally maintained MTA such as the one provided by your internet service provider (ISP).
Your ISP's MTA is a good choice for this because you are their customer and they expect to manage mail on your behalf. You could instead use something like Google Mail for that, but it will generally present more obstacles because it's open to the public.
Here I will show an example where your ISP is Comcast. On the server we will install SSMTP and Mailx for mail transport. SSMTP is a simple MTA proxy and Mailx is a simple Mail User Agent (MUA). To install these on an Ubuntu or Debian server, do this:
Code: Select all
sudo apt-get install ssmtp
sudo apt-get install bsd-mailx
Next, make sure you have your email login ID and password for your Comcast email account. These are needed because Comcast will require authentication before forwarding email to ensure you are not a random spammer.
Then edit the file /etc/ssmtp/ssmtp.conf so that it looks something like this:
Code: Select all
root=YourNormalEmailAddress
mailhub=smtp.comcast.net:587
UseSTARTTLS=YES
UseTLS=YES
AuthUser=YourComcastLogin
AuthPass=YourComcastPassword
rewritedomain=SomeDomainName.com
hostname=AnyHostName
FromLineOverride=YES
You can leave the existing commented-out lines in there as helpful documentation.
Then you can test email sending to your normal email account with a command like this:
Code: Select all
echo test | mail -v -s "testing ssmtp setup" root
Make sure the command completes without errors, and that you receive the email. It may be in your Spam folder.