How to properly send out email messages on a server when having an external mail server to your local area network. If this process is not done, email most likely will not be received as it would be invalid and/or blocked by spam filtering.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Adam 7ec0268f71 Correcting first markdown heading format. 3 years ago
README.md Correcting first markdown heading format. 3 years ago

README.md

Fedora OS

  • Install Exim and Mailx packages.

dnf exim mailx

- Create Exim configuration file at "/etc/exim/exim.conf". Make sure the TLS paths are correctly set along with routers and transports values. CONFDIR = /etc/exim daemon_smtp_port = 25 : 465 tls_on_connect_ports = 465 tls_certificate = /etc/pki/tls/certs/ssl-bundle.crt tls_privatekey = /etc/pki/tls/private/betelgeuse.key disable_ipv6 hostlist hl_localhost = @ : 127.0.0.1 : ::::1 domainlist dl_local = @ hostlist hl_relay_from = +hl_localhost local_interfaces = 127.0.0.1 : ::::1 gecos_pattern = ^([^,:]*) gecos_name = $1 smtp_banner = DSI ESMTP keep_environment = ignore_bounce_errors_after = 12h add_environment = PATH=/usr/bin::/bin #message_id_header_domain = vps.displaysystemsintl.com acl_smtp_connect = acl_check_connect acl_smtp_helo = acl_check_helo acl_smtp_mail = acl_check_mail acl_smtp_rcpt = acl_check_rcpt acl_smtp_data = acl_check_data

##############################################################################

ACL CONFIGURATION

############################################################################## begin acl

acl_check_connect:

accept from local hosts

accept hosts = +hl_localhost

accept from all others after a connection delay

some spammers will not wait for a connection

accept delay = 1s

acl_check_helo:

accept from local hosts

accept hosts = +hl_localhost

prevent remote site claiming to be local site

deny message = invalid HELO host condition = ${if
match_domain {${lc:$sender_helo_name}}{+dl_local}
{true}{false}
}

accept

acl_check_mail:

deny if no HELO command given

deny condition = ${if def:sender_helo_name {no}{yes}} delay = 10s message = no HELO given before MAIL command

accept

acl_check_rcpt:

accept if the source is local SMTP (not TCP/IP)

accept hosts = :

deny domains = +dl_local local_parts = ^[.] : ^.*[@%!/|`#&?] message = restricted characters in address

deny domains = !+dl_local local_parts = ^[./|] : ^.[@%!`#&?] : ^./\.\./ message = restricted characters in address from non-local connection

accept for relay hosts

accept hosts = +hl_relay_from control = submission/sender_retain

allow relaying for authenticated connection

accept authenticated = * control = submission/sender_retain

deny !domains = +dl_local message = relay not permitted

deny !verify = recipient

acl_check_data: accept

##############################################################################

ROUTERS CONFIGURATION

############################################################################## begin routers

smarthost: driver = manualroute domains = !+dl_local transport = remote_smtp route_list = * mail.displaysystemsintl.com ignore_target_hosts = <; 0.0.0.0 ; 127.0.0.0/8 ; ::1

headers_remove = received:message-id

##############################################################################

TRANSPORTS CONFIGURATION

############################################################################## begin transports

remote_smtp: debug_print = "T: remote_smtp for $local_part@$domain" driver = smtp hosts_require_auth = mail.displaysystemsintl.com #hosts_try_auth = ${if exists {CONFDIR/passwd.client}{DCsmarthost}{}}

begin rewrite

@.displaysystemsintl.com $1@displaysystemsintl.com *@displaysystemsintl.com systems@displaysystemsintl.com Ffrs

begin authenticators

fixed_plain: driver = plaintext public_name = PLAIN hide client_send = ^sh.relay@displaysystemsintl.com^put-password-here

  • Set ownership.

chown root:root /etc/exim/exim.conf

- Enable and start Exim service. # systemctl enable exim.service # systemctl start exim.service - Test rewrite rules. $ exim -brw webmaster@betelgeuse.dsi.displaysystemsintl.com sender: systems@displaysystemsintl.com from: systems@displaysystemsintl.com to: webmaster@displaysystemsintl.com cc: webmaster@displaysystemsintl.com bcc: webmaster@displaysystemsintl.com reply-to: systems@displaysystemsintl.com env-from: systems@displaysystemsintl.com env-to: webmaster@displaysystemsintl.com - Test routing rules. $ exim -bt webmaster@displaysystemsintl.com webmaster@displaysystemsintl.com router = smarthost, transport = remote_smtp host mail.displaysystemsintl.com [199.103.61.65] - Send a test email message. When done typing the body of the email press enter and then CTRL-D to send/quit. $ mailx -v -s "This is a test" webmaster@displaysystemsintl.com This is a test of the email smarthost configuration. EOT LOG: MAIN <= systems@displaysystemsintl.com U=adam.douglas P=local S=633 [adam.douglas@betelgeuse ~]$ delivering 1h1EDi-0003SN-16 T: remote_smtp for webmaster@displaysystemsintl.com Connecting to mail.displaysystemsintl.com [199.103.61.65]:25 ... connected SMTP<< 220-vps.displaysystemsintl.com ESMTP Exim 4.91 #1 Tue, 05 Mar 2019 12:51:14 -0500 220-We do not authorize the use of this system to transport unsolicited, 220 and/or bulk e-mail. SMTP>> EHLO betelgeuse.dsi.displaysystemsintl.com SMTP<< 250-vps.displaysystemsintl.com Hello betelgeuse.dsi.displaysystemsintl.com [184.69.56.146] 250-SIZE 52428800 250-8BITMIME 250-PIPELINING 250-STARTTLS 250 HELP SMTP>> STARTTLS SMTP<< 220 TLS go ahead SMTP>> EHLO betelgeuse.dsi.displaysystemsintl.com SMTP<< 250-vps.displaysystemsintl.com Hello betelgeuse.dsi.displaysystemsintl.com [184.69.56.146] 250-SIZE 52428800 250-8BITMIME 250-PIPELINING 250-AUTH PLAIN LOGIN 250 HELP SMTP>> AUTH PLAIN ************************************************************************ SMTP<< 235 Authentication succeeded SMTP>> MAIL FROM: SIZE=1671 AUTH=adam.douglas@betelgeuse.dsi.displaysystemsintl.com SMTP>> RCPT TO: SMTP>> DATA SMTP<< 250 OK SMTP<< 250 Accepted SMTP<< 354 Enter message, ending with "." on a line by itself SMTP>> writing message and terminating "." SMTP<< 250 OK id=1h1EDi-0007wP-IH SMTP>> QUIT SMTP(close)>> LOG: MAIN => webmaster@displaysystemsintl.com R=smarthost T=remote_smtp H=mail.displaysystemsintl.com [199.103.61.65] X=TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256 CV=yes A=fixed_plain C="250 OK id=1h1EDi-0007wP-IH" LOG: MAIN Completed