Difference between revisions of "OS4X VMware virtualized image - mail configuration"

From OS4X
Jump to navigation Jump to search
 
(9 intermediate revisions by the same user not shown)
Line 35: Line 35:
 
*Machines to relay mail for: ''(keep default)'' [empty]
 
*Machines to relay mail for: ''(keep default)'' [empty]
 
*IP address or host name of the outgoing smarthost: ''The IP/hostname of the relay host.''
 
*IP address or host name of the outgoing smarthost: ''The IP/hostname of the relay host.''
 +
**SMTP over (START)TLS: if you need to configure a different (non-standard SMTP 25) port number for the smart host connection, the format is "<hostname or IP>::<port number>" (yes, two double points). Example: "smtp-server::587".
 
*Hide local mail name in outgoing mail? ''(keep default)'' No
 
*Hide local mail name in outgoing mail? ''(keep default)'' No
 
*Keep number of DNS-queries minimal (Dial-on-Demand)? ''(keep default)'' No
 
*Keep number of DNS-queries minimal (Dial-on-Demand)? ''(keep default)'' No
Line 40: Line 41:
 
*Split configuration into small files?  Yes
 
*Split configuration into small files?  Yes
  
=== Relay authentification ===
+
=== Relay authentication ===
 
If you need to authenticate against an existing relay host with a given username and password, you have to do the following:
 
If you need to authenticate against an existing relay host with a given username and password, you have to do the following:
 
*Edit the file "<code>/etc/exim4/passwd.client</code>" with your favorite editor (i.e. "<code>vi</code>")
 
*Edit the file "<code>/etc/exim4/passwd.client</code>" with your favorite editor (i.e. "<code>vi</code>")
Line 46: Line 47:
 
*Add a line with the following syntax:
 
*Add a line with the following syntax:
 
  yourdomain.com:user@yourdomain.com:yourpassword
 
  yourdomain.com:user@yourdomain.com:yourpassword
 +
*If authentication fails (which can be examined in the Exim's logfile "<code>/var/log/exim4/mainlog</code>"), try the following syntax:
 +
*:user@yourdomain.com:yourpassword
 
*Reload the configuration of Exim:
 
*Reload the configuration of Exim:
 
  update-exim4.conf
 
  update-exim4.conf
 +
*Create the file "<code>/etc/exim4/exim4.conf.localmacros</code>" with the following content:
 +
AUTH_CLIENT_ALLOW_NOTLS_PASSWORDS = 1
 +
*Restart Exim:
 +
service exim4 restart
  
 
== Change sender's mail address ==
 
== Change sender's mail address ==
 
OS4X's mailing functionality is running as a [[OS4X_Core_configuration#run_OS4X_programs_as_user|configured user]] (which is normally the webserver user, in this case "<code>www-data</code>"). You can configure that this user ("<code>www-data</code>") is mapped to another outgoing email address.
 
OS4X's mailing functionality is running as a [[OS4X_Core_configuration#run_OS4X_programs_as_user|configured user]] (which is normally the webserver user, in this case "<code>www-data</code>"). You can configure that this user ("<code>www-data</code>") is mapped to another outgoing email address.
 +
 +
In our example, all mails sent by OS4X shall be sent by the email address "<code>os4x@mydomain.com</code>":
 +
*Edit the file "<code>/etc/email-addresses</code>" with your favorite editor, i.e. "<code>vi</code>":
 +
vi /etc/email-addresses
 +
*Add a line with the [[OS4X_Core_configuration#run_OS4X_programs_as_user|configured user]] running OS4X ("<code>www-data</code>"):
 +
www-data: os4x@mydomain.com
 +
 +
== Troubleshooting ==
 +
=== Logging ===
 +
In any case of problems, take a look at Exim's log file:
 +
tail -f /var/log/exim4/mainlog
 +
 +
You can send emails with the system's "<code>sendmail</code>" program:
 +
echo test | sendmail contact@os4x.com
 +
 +
=== "Mail too big" error message ===
 +
If you receive the message
 +
message is too big (transport limit = 1)
 +
in <code>/var/log/exim4/mainlog</code>, append to the file "<code>/etc/exim4/update-exim4.conf.conf</code>" the following line:
 +
IGNORE_SMTP_LINE_LENGTH_LIMIT=1
 +
Restart Exim4 afterwards:
 +
service exim4 restart

Latest revision as of 14:52, 27 May 2021

The OS4Xvirtual Linux environment comes with a pre-installed Mail Transfer Agent (MTA) called "Exim" in version 4. You can configure Exim4 to your needs in order to send emails within your system environment.

Basics

Exim4 is best configured on command line (i.e. via SSH) via a dialog based system. This system easily helps you to accomplish your configuration task.

The command to be executed as root is:

dpkg-reconfigure exim4-config

The following informational prompt asks you to confirm the "OK" button:

Dpkg-reconfigure exim4-config.png

Direct mail sending - without mail relay

If you can send emails directly via SMTP (i.e. your OS4X machine has direct internet access), you can choose the first option "internet site; mail is sent and received directly using SMTP":

Dpkg-reconfigure exim4-config-1.png

You will then need the following settings:

  • System mail name: The full qualified domain name (FQDN) of the OS4X system (i.e. "os4x.com", "c-works.de" or whatever your mail domain is).
  • IP-addresses to listen on for incoming SMTP connections: (keep default) 127.0.0.1 ; ::1
  • Other destinations for which mail is accepted: (keep default)
  • Domains to relay mail for: (keep default) [empty]
  • Machines to relay mail for: (keep default) [empty]
  • Keep number of DNS-queries minimal (Dial-on-Demand)? (keep default) No
  • Delivery method for local mail: (keep default or change to whatever your prefered type is) mbox format in /var/mail/
  • Split configuration into small files? (keep default) No

Mail sending over SMTP relay (aka. "smarthost")

If your network provides an existing mail server, the option "mail sent by smarthost; received via SMTP or fetchmail" will be the best one:

Dpkg-reconfigure exim4-config-2.png

  • System mail name: The full qualified domain name (FQDN) of the OS4X system (i.e. "os4x.com", "c-works.de" or whatever your mail domain is).
  • IP-addresses to listen on for incoming SMTP connections: (keep default) 127.0.0.1 ; ::1
  • Other destinations for which mail is accepted: (keep default)
  • Machines to relay mail for: (keep default) [empty]
  • IP address or host name of the outgoing smarthost: The IP/hostname of the relay host.
    • SMTP over (START)TLS: if you need to configure a different (non-standard SMTP 25) port number for the smart host connection, the format is "<hostname or IP>::<port number>" (yes, two double points). Example: "smtp-server::587".
  • Hide local mail name in outgoing mail? (keep default) No
  • Keep number of DNS-queries minimal (Dial-on-Demand)? (keep default) No
  • Delivery method for local mail: (keep default or change to whatever your prefered type is) mbox format in /var/mail/
  • Split configuration into small files? Yes

Relay authentication

If you need to authenticate against an existing relay host with a given username and password, you have to do the following:

  • Edit the file "/etc/exim4/passwd.client" with your favorite editor (i.e. "vi")
vi /etc/exim4/passwd.client
  • Add a line with the following syntax:
yourdomain.com:user@yourdomain.com:yourpassword
  • If authentication fails (which can be examined in the Exim's logfile "/var/log/exim4/mainlog"), try the following syntax:
*:user@yourdomain.com:yourpassword
  • Reload the configuration of Exim:
update-exim4.conf
  • Create the file "/etc/exim4/exim4.conf.localmacros" with the following content:
AUTH_CLIENT_ALLOW_NOTLS_PASSWORDS = 1
  • Restart Exim:
service exim4 restart

Change sender's mail address

OS4X's mailing functionality is running as a configured user (which is normally the webserver user, in this case "www-data"). You can configure that this user ("www-data") is mapped to another outgoing email address.

In our example, all mails sent by OS4X shall be sent by the email address "os4x@mydomain.com":

  • Edit the file "/etc/email-addresses" with your favorite editor, i.e. "vi":
vi /etc/email-addresses
www-data: os4x@mydomain.com

Troubleshooting

Logging

In any case of problems, take a look at Exim's log file:

tail -f /var/log/exim4/mainlog

You can send emails with the system's "sendmail" program:

echo test | sendmail contact@os4x.com

"Mail too big" error message

If you receive the message

message is too big (transport limit = 1)

in /var/log/exim4/mainlog, append to the file "/etc/exim4/update-exim4.conf.conf" the following line:

IGNORE_SMTP_LINE_LENGTH_LIMIT=1

Restart Exim4 afterwards:

service exim4 restart