Difference between revisions of "Emails"

From wiki
(Ip address)
(add authentication to external smarthost)
Line 21: Line 21:
 
dc_minimaldns='false'
 
dc_minimaldns='false'
 
dc_relay_nets=''
 
dc_relay_nets=''
dc_smarthost='smtp.example.rocks::587'
+
dc_smarthost='smtp.example.org::587'
 
CFILEMODE='644'
 
CFILEMODE='644'
 
dc_use_split_config='true'
 
dc_use_split_config='true'
Line 27: Line 27:
 
dc_mailname_in_oh='true'
 
dc_mailname_in_oh='true'
 
dc_localdelivery='mail_spool'
 
dc_localdelivery='mail_spool'
</syntaxhighlight>Activate the new configuration using<syntaxhighlight lang="console">
+
</syntaxhighlight>Edit file <code>/etc/exim4/passwd.client</code> and add a line like<syntaxhighlight lang="properties">
 +
smtp.example.org:username:mYpa$$w0rd
 +
</syntaxhighlight>'''Note:''' if <code>smtp.example.org</code> is a CNAME, you must use the destination of the CNAME in the <code>passwd.client</code> file.<syntaxhighlight lang="console">
 +
$ host smtp.gmail.com
 +
smtp.gmail.com is an alias for gmail-smtp-msa.l.google.com.
 +
gmail-smtp-msa.l.google.com has address 74.125.206.108
 +
gmail-smtp-msa.l.google.com has address 74.125.206.109
 +
gmail-smtp-msa.l.google.com has IPv6 address 2a00:1450:400c:c04::6d
 +
</syntaxhighlight>here you see on the first line that <code>smtp.gmail.com</code> is a CNAME to <code>gmail-smtp-msa.l.google.com</code>. In that case you can put <code>*.google.com</code> in the password file.
 +
 
 +
Finally, activate the new configuration using<syntaxhighlight lang="console">
 
# service exim4 reload
 
# service exim4 reload
 
</syntaxhighlight>
 
</syntaxhighlight>

Revision as of 06:14, 2 June 2016

Sending emails is important for a server. It allows the server to notify remote users (you) in can you need to do some action.

This guide will show you two different configuration options:

  • Send only: Simple configuration. The server uses an external SMTP server to send emails. It can't receive emails
  • Send and Receive: More complex configuration. It allows you to handle your complete email infrastructure.

Send only

Install

# apt install exim4-daemon-light bsd-mailx

Configure

Edit file /etc/exim4/update-exim4.conf.conf

dc_eximconfig_configtype='satellite'
dc_other_hostnames=''
dc_local_interfaces='127.0.0.1; ::1'
dc_readhost='example.org'
dc_relay_domains=''
dc_minimaldns='false'
dc_relay_nets=''
dc_smarthost='smtp.example.org::587'
CFILEMODE='644'
dc_use_split_config='true'
dc_hide_mailname='true'
dc_mailname_in_oh='true'
dc_localdelivery='mail_spool'

Edit file /etc/exim4/passwd.client and add a line like

smtp.example.org:username:mYpa$$w0rd

Note: if smtp.example.org is a CNAME, you must use the destination of the CNAME in the passwd.client file.

$ host smtp.gmail.com
smtp.gmail.com is an alias for gmail-smtp-msa.l.google.com.
gmail-smtp-msa.l.google.com has address 74.125.206.108
gmail-smtp-msa.l.google.com has address 74.125.206.109
gmail-smtp-msa.l.google.com has IPv6 address 2a00:1450:400c:c04::6d

here you see on the first line that smtp.gmail.com is a CNAME to gmail-smtp-msa.l.google.com. In that case you can put *.google.com in the password file. Finally, activate the new configuration using

# service exim4 reload

Test

$ echo "test" | mailx -s "test" root

You should receive the email in your mailbox

Send and Receive

TODO