~/.forward
file with the destination email (ie. [email protected]). Then chmod 644
the file.If you have some Linux servers and want them to dispatch your emails (system, logging, monitoring, etc) to an external email address, you can use a proper SMTP service, like Gmail, for that.
Notice that this will not work for mass emails. The idea is to send a few emails per day to yourself. If you're relaying emails for actual users, you must set up a dedicated mail server or use an external service like Mailgun or Amazon Simple Email Service.
I'm assuming:
1) you want your Linux box to send emails from an existing Gmail account
2) you've created an "app specific password" for this service
Remove possible previous installations of sendmail
, postfix
, exim
and qmail
:
sudo apt-get remove packagename sendmail postfix exim qmail
Install postfix
:
sudo apt-get install postfix
Configure postfix
with the values below:
sudo vim /etc/postfix/main.cf
Create a file with your Gmail account
and access credentials:
sudo vim /etc/postfix/sasl/sasl_password
With the following content:
smtp.gmail.com [email protected]:your-app-password-here
And then convert it into a database file that postfix
can read:
Restart the service:
sudo /etc/init.d/postfix restart
And now send an email using the command line to check if everything's working as it should:
The logs should show something like this:
Alternatively, you can also check your Gmail "sent folder". As the email is sent using your Gmail account (using SMTP), the email will also be there.
Edit: Thanks to u/kevdogger for pointing that in Arch Linux, the default is no longer B-tree maps but lmdb (Lightning Memory-Mapped Database) and, as such, you will need to change main.cf
to point to the correct file.
The easiest way is to prefix the map with the actual type, something like this:
Last Christmas, my wife asked for walkie-talkies. I thought it would be one of those gifts that end up collecting dust, but decided to get her a high-quality set anyway. We now use them regularly—at least once a month—for just about everything. From road trips and hikes to beach outings, these walkie-talkies have become an essential part of our adventures.
When a product genuinely delivers on its promise, it makes all the difference. I can’t recommend these enough.
As an Amazon Associate I may earn from qualifying purchases on some links.
If you found this page helpful, please share.