Browse and search developer information

NHSmail APIs Sending Automated Email

Sending automated email

It is possible to create an application that integrates with NHSmail to send automatic email messages.

There are certain criteria that must be followed to ensure that the application works seamlessly with NHSmail. These are listed below.

Connection details

To successfully connect your application to NHSmail you must use the following settings (only LDAP works from the Internet, the others are only available from the Transition Network / HSCN):






Authentication required? 

IMAP  Receiving email  993  SSL  Yes 
POP  Receiving email  995  SSL  Yes 
SMTP  Sending  587  TLS  Yes 
LDAP  Email address resolution  636  SSL  No 

If your application does not support any of the protocols above you may choose to transmit your email through our relay server. The connection details are:

Server name 

Server IP addresses,

Port number 


Authentication type 

Anonymous access 

You must ensure that the firewall rules on your SMTP server allow outbound traffic through the IP address and port numbers above.

The IP address of your server must be registered on the Transition Network / HSCN as our relay service carries out a reverse lookup when transmitting email messages. If you do not register the IP address then relay will check that a Domain Name System (DNS) record exists on the Transition Network / HSCN when carrying out its reverse lookup. If the IP address of the relay requestor is not registered, the request will be refused and the email will not be routed to its destination. To ensure a resilient service, best practice approach should be implemented; do not use hardcoded IPs, but instead use the DNS name –

Note: you only need to register your IP address with the DNS team if you are sending via with no authentication. Other connection methods (IMAP, POP etc.) do not require you to register your server with the DNS team.

To register the IP address of your server on the Transition Network / HSCN, contact the DNS team at

To send email using your application:

  • Where the connection must be authenticated, the full email address of the NHSmail account should be entered as the username (e.g.
  • Outbound (SMTP) connections must use TLS and not SSL
  • The ‘from’ field must match the email address that you are using to send from. If a different ‘from’ address is used the message may be rejected as spam
  • IMAP is recommended rather than POP for receiving email as it is a more feature rich/robust protocol
  • The mailbox must be within quota. If the mailbox is over quota then any emails will not be sent
  • The mailbox size must be managed in the same way as a regular user mailbox. If you are sending large volumes then you should regularly check the status of the account to ensure it is within quota
  • Individual messages must not exceed 35Mb in size
  • Emails can’t be sent to more than 5000 recipients in a single email unless an NHSmail distribution list is used
  • When sending to distribution lists the application should be configured to send at a minimum of 30 minute intervals
  • You must use a separate, application, email account for your application. This will make it easier to manage the account in terms of keeping it under quota, monitoring replies and setting permissions
  • The reply to email address must be valid. Non-delivery addresses, such as, must not be used. Applications found using non-delivery addresses may be blocked from NHSmail.

IMAP and POP display name field

If you configure an NHSmail account using POP or IMAP with an application, you must ensure that the display name field is populated correctly. This applies to any configured application, be it Outlook or a coded application developed in-house. For example in Outlook the field is called ‘Your Name’. When sending to a non NHSmail address this is the name that will show in the recipient’s mailbox. The name must be entered as Lastname, Firstname.

In the example below, an NHSmail account has been configured using POP and ‘Smith, John’ has been entered in the ‘Your Name’ field. An email has been sent to a non-NHSmail email address and the recipient’s mailbox shows the following:

Example, an NHSmail account has been configured using POP