Configure exim4 to use an O2 mail relay

To configure exim4 to use O2’s SMTP server for outbound mail:

(As root) edit /etc/exim4/passwd.client and add your O2 portal authentication credentials.

See ‘man exim4_passwd_client’ for how exim4 parses this file.

Note that smtp.o2.co.uk resolves to the IP address 82.132.141.69, but the reverse DNS for that IP address resolves to mail.o2.co.uk, so you will need to use that name in passwd.client.

The line in passwd.client should look something like this:

mail.o2.co.uk:yourname@o2.co.uk:your_password

O2’s mail servers don’t support TLS so you will need to add the following line to /etc/exim4/exim4.conf.localmacros (just create the file if it doesn’t exist already)

AUTH_CLIENT_ALLOW_NOTLS_PASSWORDS = true

This allows passwords to be sent over an insecure connection. It’s far from ideal but nothing can be done until O2 supports TLS.

Finally run ‘dpkg-reconfigure exim4-config’ to update the mail server configuration.

Select ‘mail sent by smarthost; received via SMTP or fetchmail‘ and when it asks for the smarthost address use smtp.o2.co.uk.

You should now be sending email using O2’s smarthost.

Check /var/log/exim4/mainlog when sending mail to confirm that everything is OK.

Sending email from an O2 Broadband connection

There are many options for sending email from an O2 Home Broadband connection:

  • If you have a static IP address (provided free with ‘The Works’ package or as a cost option in other packages) and you have access to a third party mail relay (e.g. SMTP2Go or AuthSMTP), you can connect directly to the external SMTP server on port 25
  • If you have a regular dynamic IP address then you can still connect to an external mail relay, but O2 blocks port 25 (SMTP) and so you will have to connect on port 587 (message submission)
  • Use the O2 Broadband mail relay – relay.o2broadband.co.uk – this will only accept mail from your broadband connection and will not work when outside of your home network
  • Use the O2 Mobile Data mail relay – smtp.o2.co.uk – you will need to authenticate yourself using your O2 portal username and password

If using smtp.o2.co.uk then you will also need to authenticate yourself using your O2 portal username and password. Note that even if using your own domain name your O2 username will also be made visible to the recipient in the mail headers, e.g.

Received: from yourhost.example.com by mail.o2.co.uk (8.5.119.05) (authenticated as yourlogin@o2.co.uk)

O2’s mail servers do not support SSL/TLS and so you will need to specify an insecure connection when configuring your mail client.

In the Windows Mail client go into the mail account properties and under the Outgoing Mail Server settings in the Servers tab tick the box next to ‘Outgoing Mail Server: My server requires authentication’. Go into these settings, fill in the account name and password with your O2 portal credentials and make sure that ‘Log on using Secure Password Authentication’ is NOT checked. In Advanced settings make sure that ‘This server requires a secure connection (SSL) is NOT checked.

For Unix users I have provided instructions for configuring exim4 to use an external smarthost in a separate post.