Setting up your Linux workstation or a virtual machine, there is no public IP or domain available. If you want to send mail from this machine, reverse DNS will fail and you will get the following error message:
Helo command rejected: need fully-qualified hostname
To avoid this situation, exim4 (the default Debian MTA) can be adjusted to use SMARTHOST (in this case a gmail account, but any other smtp server can be used).
Settings
Configure exim4 as following:
dpkg-reconfigure exim4-config
Credentials
Create the file passwd.client
nano /etc/exim4/passwd.client
with the following contents
*.google.com:your_username@gmail.com:password_here
NOTE: if the password contains special characters ($, , {}) you
have to escape them. A simple solution is to use a strong password,
but without dollar, closing brace, backslash, e.g. something like
Nca-PZRn2_kfqW
Test it
Send a test mail to your email account
mail your_mail@example.com -s 'test my setup'
test
Cc:
Press CTRL+D to exit
Check log file
tail /var/log/exim4/mainlog
...
2014-07-26 21:02:21 1S0dvp-0001Ce-2Z <= root@atlas U=root P=local S=317
2014-07-26 21:02:27 1S0dvp-0001Ce-2Z => pontikis@gmail.com R=smarthost T=remote_smtp_smarthost H=gmail-smtp-msa.l.google.com [173.194.67.108] X=TLS1.0:RSA_ARCFOUR_SHA1:16 DN="C=US,ST=California,L=Mountain View,O=Google Inc,CN=smtp.gmail.com"
2014-07-26 21:02:27 1S0dvp-0001Ce-2Z Completed
Entrepreneur | Full-stack developer | Founder of MediSign Ltd. I have over 15 years of professional experience designing and developing web applications. I am also very experienced in managing (web) projects.